├── .DS_Store
├── .gitignore
├── .idea
├── Selenium-Demo.iml
├── misc.xml
├── modules.xml
├── vcs.xml
└── workspace.xml
├── API
├── APIExamples.py
└── users.json
├── PytestSessions
├── PytestBasics.py
├── __init__.py
├── __pycache__
│ ├── __init__.cpython-37.pyc
│ ├── pytest_fixture.cpython-37-pytest-6.0.1.pyc
│ ├── test_demo.cpython-37-pytest-6.0.1.pyc
│ ├── test_fixture_classes.cpython-37-pytest-6.0.1.pyc
│ ├── test_fixture_params.cpython-37-pytest-6.0.1.pyc
│ ├── test_google_fixture.cpython-37-pytest-6.0.1.pyc
│ └── test_google_test.cpython-37-pytest-6.0.1.pyc
├── assets
│ └── style.css
├── geckodriver.log
├── new.html
├── new_params.html
├── test_demo1.py
├── test_demo2.py
├── test_demo3.py
├── test_facebook.py
├── test_fix.html
├── test_fixture_classes.py
├── test_fixture_params.py
├── test_google_fixture.py
├── test_google_test.py
└── test_webpage_login.py
└── SeleniumSessions
├── AlertJSPopUp.py
├── AuthPopUpHandle.py
├── BackAndForward.py
├── CerificateErrorHandle.py
├── CookiesConcept.py
├── DataFile.xls
├── DragAndDrop.py
├── DropDownHandle.py
├── ElementActionsConcept.py
├── ElementToBeClickableConcept.py
├── FileUploadHandle.py
├── HandleFrame.py
├── HeadLessBrowsers.py
├── ImplicitWaitConcept.py
├── JSConcept.py
├── JavaScriptExecutorConcept.py
├── JqueryDropDown.py
├── LocatorCSSClassName.py
├── LocatorsConcept.py
├── LocatorsName.py
├── LocatorsTagName.py
├── MoveToElementConcept.py
├── ReadExcel.py
├── RightClick.py
├── ScreenshotConcept.py
├── TotalLinks.py
├── WDBasics.py
├── WaitForAlertConcept.py
├── WaitForElementsConcept.py
├── WebDriverWaitConcept.py
├── WebElement.py
├── __init__.py
├── calc.py
├── cert.py
├── cookies.py
├── different_waits
├── excel
├── full_screen_reddit.png
├── geckodriver.log
├── login.py
├── reddit.png
├── reddit_1.png
├── reddit_full_1.png
├── screenshot.png
├── switchTo.py
└── web_screenshot.png
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | venv/
2 |
--------------------------------------------------------------------------------
/.idea/Selenium-Demo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 | 1593702218654
307 |
308 |
309 | 1593702218654
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
--------------------------------------------------------------------------------
/API/APIExamples.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import json
3 | import jsonpath
4 |
5 | # URL = 'https://reqres.in/api/users?page=2'
6 | #
7 | # '''get call'''
8 | # response = requests.get(URL)
9 | # print(response.url)
10 | # print(response.status_code)
11 | # print(response.content)
12 | # print(response.headers['content-type'])
13 | # # print(response.cookies)
14 | # # print(response.encoding)
15 | # # print(response.history)
16 | # # print(response.elapsed)
17 | # json_format = json.loads(response.text)
18 | # print(json_format)
19 | # first_name = jsonpath.jsonpath(json_format, 'data[0].first_name')
20 | # print(first_name)
21 | # assert first_name[0]== 'Michael'
22 | # page = jsonpath.jsonpath(json_format, 'page')
23 | # assert page[0] == 2
24 |
25 |
26 | '''post call'''
27 | URL = 'https://reqres.in/api/users'
28 | file = open('/Users/NaveenKhunteta/PycharmProjects/Selenium-Demo/API/users.json', 'r')
29 | json_data = file.read()
30 | json_input = json.loads(json_data)
31 | response = requests.post(URL, json_input)
32 | print('status code: ', response.status_code)
33 | print('response body', json.loads(response.text))
34 |
--------------------------------------------------------------------------------
/API/users.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "morpheus",
3 | "job": "leader"
4 | }
--------------------------------------------------------------------------------
/PytestSessions/PytestBasics.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | #start with test
4 | #end with test
5 |
6 | def test_m11():
7 | name = "selenium"
8 | assert name.upper() == "SELENIUM"
9 |
10 |
--------------------------------------------------------------------------------
/PytestSessions/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/PytestSessions/__init__.py
--------------------------------------------------------------------------------
/PytestSessions/__pycache__/__init__.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/PytestSessions/__pycache__/__init__.cpython-37.pyc
--------------------------------------------------------------------------------
/PytestSessions/__pycache__/pytest_fixture.cpython-37-pytest-6.0.1.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/PytestSessions/__pycache__/pytest_fixture.cpython-37-pytest-6.0.1.pyc
--------------------------------------------------------------------------------
/PytestSessions/__pycache__/test_demo.cpython-37-pytest-6.0.1.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/PytestSessions/__pycache__/test_demo.cpython-37-pytest-6.0.1.pyc
--------------------------------------------------------------------------------
/PytestSessions/__pycache__/test_fixture_classes.cpython-37-pytest-6.0.1.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/PytestSessions/__pycache__/test_fixture_classes.cpython-37-pytest-6.0.1.pyc
--------------------------------------------------------------------------------
/PytestSessions/__pycache__/test_fixture_params.cpython-37-pytest-6.0.1.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/PytestSessions/__pycache__/test_fixture_params.cpython-37-pytest-6.0.1.pyc
--------------------------------------------------------------------------------
/PytestSessions/__pycache__/test_google_fixture.cpython-37-pytest-6.0.1.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/PytestSessions/__pycache__/test_google_fixture.cpython-37-pytest-6.0.1.pyc
--------------------------------------------------------------------------------
/PytestSessions/__pycache__/test_google_test.cpython-37-pytest-6.0.1.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/PytestSessions/__pycache__/test_google_test.cpython-37-pytest-6.0.1.pyc
--------------------------------------------------------------------------------
/PytestSessions/assets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Helvetica, Arial, sans-serif;
3 | font-size: 12px;
4 | /* do not increase min-width as some may use split screens */
5 | min-width: 800px;
6 | color: #999;
7 | }
8 |
9 | h1 {
10 | font-size: 24px;
11 | color: black;
12 | }
13 |
14 | h2 {
15 | font-size: 16px;
16 | color: black;
17 | }
18 |
19 | p {
20 | color: black;
21 | }
22 |
23 | a {
24 | color: #999;
25 | }
26 |
27 | table {
28 | border-collapse: collapse;
29 | }
30 |
31 | /******************************
32 | * SUMMARY INFORMATION
33 | ******************************/
34 |
35 | #environment td {
36 | padding: 5px;
37 | border: 1px solid #E6E6E6;
38 | }
39 |
40 | #environment tr:nth-child(odd) {
41 | background-color: #f6f6f6;
42 | }
43 |
44 | /******************************
45 | * TEST RESULT COLORS
46 | ******************************/
47 | span.passed, .passed .col-result {
48 | color: green;
49 | }
50 | span.skipped, span.xfailed, span.rerun, .skipped .col-result, .xfailed .col-result, .rerun .col-result {
51 | color: orange;
52 | }
53 | span.error, span.failed, span.xpassed, .error .col-result, .failed .col-result, .xpassed .col-result {
54 | color: red;
55 | }
56 |
57 |
58 | /******************************
59 | * RESULTS TABLE
60 | *
61 | * 1. Table Layout
62 | * 2. Extra
63 | * 3. Sorting items
64 | *
65 | ******************************/
66 |
67 | /*------------------
68 | * 1. Table Layout
69 | *------------------*/
70 |
71 | #results-table {
72 | border: 1px solid #e6e6e6;
73 | color: #999;
74 | font-size: 12px;
75 | width: 100%
76 | }
77 |
78 | #results-table th, #results-table td {
79 | padding: 5px;
80 | border: 1px solid #E6E6E6;
81 | text-align: left
82 | }
83 | #results-table th {
84 | font-weight: bold
85 | }
86 |
87 | /*------------------
88 | * 2. Extra
89 | *------------------*/
90 |
91 | .log:only-child {
92 | height: inherit
93 | }
94 | .log {
95 | background-color: #e6e6e6;
96 | border: 1px solid #e6e6e6;
97 | color: black;
98 | display: block;
99 | font-family: "Courier New", Courier, monospace;
100 | height: 230px;
101 | overflow-y: scroll;
102 | padding: 5px;
103 | white-space: pre-wrap
104 | }
105 | div.image {
106 | border: 1px solid #e6e6e6;
107 | float: right;
108 | height: 240px;
109 | margin-left: 5px;
110 | overflow: hidden;
111 | width: 320px
112 | }
113 | div.image img {
114 | width: 320px
115 | }
116 | div.video {
117 | border: 1px solid #e6e6e6;
118 | float: right;
119 | height: 240px;
120 | margin-left: 5px;
121 | overflow: hidden;
122 | width: 320px
123 | }
124 | div.video video {
125 | overflow: hidden;
126 | width: 320px;
127 | height: 240px;
128 | }
129 | .collapsed {
130 | display: none;
131 | }
132 | .expander::after {
133 | content: " (show details)";
134 | color: #BBB;
135 | font-style: italic;
136 | cursor: pointer;
137 | }
138 | .collapser::after {
139 | content: " (hide details)";
140 | color: #BBB;
141 | font-style: italic;
142 | cursor: pointer;
143 | }
144 |
145 | /*------------------
146 | * 3. Sorting items
147 | *------------------*/
148 | .sortable {
149 | cursor: pointer;
150 | }
151 |
152 | .sort-icon {
153 | font-size: 0px;
154 | float: left;
155 | margin-right: 5px;
156 | margin-top: 5px;
157 | /*triangle*/
158 | width: 0;
159 | height: 0;
160 | border-left: 8px solid transparent;
161 | border-right: 8px solid transparent;
162 | }
163 |
164 | .inactive .sort-icon {
165 | /*finish triangle*/
166 | border-top: 8px solid #E6E6E6;
167 | }
168 |
169 | .asc.active .sort-icon {
170 | /*finish triangle*/
171 | border-bottom: 8px solid #999;
172 | }
173 |
174 | .desc.active .sort-icon {
175 | /*finish triangle*/
176 | border-top: 8px solid #999;
177 | }
178 |
--------------------------------------------------------------------------------
/PytestSessions/geckodriver.log:
--------------------------------------------------------------------------------
1 | 1596974076508 geckodriver INFO Listening on 127.0.0.1:55045
2 | 1596974077508 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileiFxgZU"
3 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
4 | 1596974080423 Marionette INFO Listening on port 55053
5 | 1596974080524 Marionette WARN TLS certificate errors will be ignored for this session
6 | 1596974081702 Marionette INFO Stopped listening on port 55053
7 | 1596974657157 geckodriver INFO Listening on 127.0.0.1:55228
8 | 1596974658165 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofilewJW9tF"
9 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
10 | 1596974661144 Marionette INFO Listening on port 55235
11 | 1596974661159 Marionette WARN TLS certificate errors will be ignored for this session
12 | 1596974662327 Marionette INFO Stopped listening on port 55235
13 | 1596974690104 geckodriver INFO Listening on 127.0.0.1:55307
14 | 1596974691112 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileZ5ap9f"
15 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
16 | 1596974694113 Marionette INFO Listening on port 55321
17 | 1596974694214 Marionette WARN TLS certificate errors will be ignored for this session
18 | 1596974696131 Marionette INFO Stopped listening on port 55321
19 | 1596977047530 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofilePGjq1z"
20 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
21 | 1596977051066 Marionette INFO Listening on port 55800
22 | 1596977051165 Marionette WARN TLS certificate errors will be ignored for this session
23 | 1596977059331 Marionette INFO Stopped listening on port 55800
24 | 1596977747689 geckodriver INFO Listening on 127.0.0.1:56061
25 | 1596977748696 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileJf3eRT"
26 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
27 | 1596977751952 Marionette INFO Listening on port 56070
28 | 1596977751961 Marionette WARN TLS certificate errors will be ignored for this session
29 | 1596977753202 Marionette INFO Stopped listening on port 56070
30 | 1596978302138 geckodriver INFO Listening on 127.0.0.1:56207
31 | 1596978303148 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofilejSSCq7"
32 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
33 | 1596978306604 Marionette INFO Listening on port 56214
34 | 1596978306612 Marionette WARN TLS certificate errors will be ignored for this session
35 | 1596978307773 Marionette INFO Stopped listening on port 56214
36 | 1596978395396 geckodriver INFO Listening on 127.0.0.1:56296
37 | 1596978396451 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofile1SgJh1"
38 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
39 | 1596978400216 Marionette INFO Listening on port 56307
40 | 1596978400224 Marionette WARN TLS certificate errors will be ignored for this session
41 | 1596978402294 Marionette INFO Stopped listening on port 56307
42 | 1596978410243 geckodriver INFO Listening on 127.0.0.1:56393
43 | 1596978411211 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileeYMu8M"
44 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
45 | 1596978415197 Marionette INFO Listening on port 56406
46 | 1596978415298 Marionette WARN TLS certificate errors will be ignored for this session
47 | 1596978418596 Marionette INFO Stopped listening on port 56406
48 | 1596978445908 geckodriver INFO Listening on 127.0.0.1:56506
49 | 1596978446912 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileHG1iou"
50 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
51 | 1596978450415 Marionette INFO Listening on port 56518
52 | 1596978450470 Marionette WARN TLS certificate errors will be ignored for this session
53 | 1596978453262 Marionette INFO Stopped listening on port 56518
54 | 1596978589546 geckodriver INFO Listening on 127.0.0.1:56664
55 | 1596978589546 geckodriver INFO Listening on 127.0.0.1:56665
56 | 1596978590562 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileDSQQa8"
57 | 1596978590562 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofilepmNFtG"
58 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
59 | console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
60 | 1596978594352 Marionette INFO Listening on port 56678
61 | 1596978594372 Marionette WARN TLS certificate errors will be ignored for this session
62 | 1596978594813 Marionette INFO Listening on port 56679
63 | 1596978594894 Marionette WARN TLS certificate errors will be ignored for this session
64 | 1596978596101 Marionette INFO Stopped listening on port 56678
65 | 1596978596466 Marionette INFO Stopped listening on port 56679
66 | console.error: services.settings:
67 | main/whats-new-panel Signature failed TypeError: NetworkError when attempting to fetch resource.
68 |
--------------------------------------------------------------------------------
/PytestSessions/new.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Test Report
6 |
7 |
8 |
245 | new.html
246 | Report generated on 09-Aug-2020 at 17:34:57 by pytest-html v2.1.1
247 | Environment
248 |
249 |
250 | JAVA_HOME
251 | /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
252 |
253 | Packages
254 | {"pluggy": "0.13.1", "py": "1.9.0", "pytest": "6.0.1"}
255 |
256 | Platform
257 | Darwin-18.7.0-x86_64-i386-64bit
258 |
259 | Plugins
260 | {"forked": "1.3.0", "html": "2.1.1", "metadata": "1.10.0", "xdist": "1.34.0"}
261 |
262 | Python
263 | 3.7.7
264 | Summary
265 | 2 tests ran in 8.75 seconds.
266 | (Un)check the boxes to filter the results.
2 passed , 0 skipped , 0 failed , 0 errors , 0 expected failures , 0 unexpected passes
267 | Results
268 |
269 |
270 |
271 | Result
272 | Test
273 | Duration
274 | Links
275 |
276 | No results found. Try to check the filters
277 |
278 |
279 | Passed
280 | test_demo.py::TestFirefox::test_google_firefox
281 | 1.77
282 |
283 |
284 |
286 |
287 |
288 | Passed
289 | test_demo.py::TestChrome::test_google_chrome
290 | 4.44
291 |
292 |
293 |
--------------------------------------------------------------------------------
/PytestSessions/new_params.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Test Report
6 |
7 |
8 |
245 | new_params.html
246 | Report generated on 09-Aug-2020 at 18:39:58 by pytest-html v2.1.1
247 | Environment
248 |
249 |
250 | JAVA_HOME
251 | /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
252 |
253 | Packages
254 | {"pluggy": "0.13.1", "py": "1.9.0", "pytest": "6.0.1"}
255 |
256 | Platform
257 | Darwin-18.7.0-x86_64-i386-64bit
258 |
259 | Plugins
260 | {"forked": "1.3.0", "html": "2.1.1", "metadata": "1.10.0", "xdist": "1.34.0"}
261 |
262 | Python
263 | 3.7.7
264 | Summary
265 | 4 tests ran in 17.62 seconds.
266 | (Un)check the boxes to filter the results.
4 passed , 0 skipped , 0 failed , 0 errors , 0 expected failures , 0 unexpected passes
267 | Results
268 |
269 |
270 |
271 | Result
272 | Test
273 | Duration
274 | Links
275 |
276 | No results found. Try to check the filters
277 |
278 |
279 | Passed
280 | test_fixture_params.py::Test_Google::test_google_url[chrome]
281 | 4.20
282 |
283 |
284 |
288 |
289 |
290 | Passed
291 | test_fixture_params.py::Test_Google::test_google_title[chrome]
292 | 4.38
293 |
294 |
295 |
299 |
300 |
301 | Passed
302 | test_fixture_params.py::Test_Google::test_google_title[firefox]
303 | 1.50
304 |
305 |
306 |
308 |
309 |
310 | Passed
311 | test_fixture_params.py::Test_Google::test_google_url[firefox]
312 | 1.47
313 |
314 |
315 |
--------------------------------------------------------------------------------
/PytestSessions/test_demo1.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | @pytest.mark.login
4 | def test_m1():
5 | a = 3
6 | b = 4
7 | assert a+1 == b, "test failed"
8 | assert a == b, "test failed as a is not eq to b"
9 |
10 | def test_m2():
11 | name = "selenium"
12 | assert name.upper() == "SELENIUM"
13 |
14 | @pytest.mark.login
15 | def test_m3():
16 | assert True
17 |
18 | def test_m4():
19 | assert False
20 |
21 | @pytest.mark.login
22 | def test_m5():
23 | assert 100 == 100
24 |
25 | def test_m6():
26 | assert "naveen" == "NAVEEN"
27 |
28 | @pytest.mark.login
29 | def test_login_FB():
30 | assert "admin" == "admin123"
31 |
--------------------------------------------------------------------------------
/PytestSessions/test_demo2.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | def test_m4():
4 | assert False
5 |
6 | @pytest.mark.home
7 | def test_m5():
8 | assert 100 == 100
9 |
10 | def test_m6():
11 | assert "naveen" == "NAVEEN"
12 |
13 | @pytest.mark.home
14 | def test_login_gmail():
15 | assert "admin" == "admin"
--------------------------------------------------------------------------------
/PytestSessions/test_demo3.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | def test_m1():
4 | a = 3
5 | b = 4
6 | assert a+1 == b, "test failed"
7 | assert a == b, "test failed as a is not eq to b"
8 |
9 | def test_m2():
10 | name = "selenium"
11 | assert name.upper() == "SELENIUM"
12 |
13 | def test_m3():
14 | assert True
15 |
16 | def test_login_Insta():
17 | assert "admin" == "admin"
--------------------------------------------------------------------------------
/PytestSessions/test_facebook.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | @pytest.fixture
4 | def setup():
5 | print("launch chrome")
6 | print("login to app")
7 |
8 |
9 | def test_home():
10 | print("home test")
11 | assert True
12 |
13 |
14 |
15 | def test_search():
16 | print("search test")
17 | assert True
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/PytestSessions/test_fix.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Test Report
6 |
7 |
8 |
245 | test_fix.html
246 | Report generated on 09-Aug-2020 at 18:25:55 by pytest-html v2.1.1
247 | Environment
248 |
249 |
250 | JAVA_HOME
251 | /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
252 |
253 | Packages
254 | {"pluggy": "0.13.1", "py": "1.9.0", "pytest": "6.0.1"}
255 |
256 | Platform
257 | Darwin-18.7.0-x86_64-i386-64bit
258 |
259 | Plugins
260 | {"forked": "1.3.0", "html": "2.1.1", "metadata": "1.10.0", "xdist": "1.34.0"}
261 |
262 | Python
263 | 3.7.7
264 | Summary
265 | 2 tests ran in 16.19 seconds.
266 | (Un)check the boxes to filter the results.
2 passed , 0 skipped , 0 failed , 0 errors , 0 expected failures , 0 unexpected passes
267 | Results
268 |
269 |
270 |
271 | Result
272 | Test
273 | Duration
274 | Links
275 |
276 | No results found. Try to check the filters
277 |
278 |
279 | Passed
280 | test_fixture_classes.py::Test_Google_Chrome::test_google_title_chrome
281 | 3.73
282 |
283 |
284 |
288 |
289 |
290 | Passed
291 | test_fixture_classes.py::Test_Google_Firefox::test_google_title_firefox
292 | 1.20
293 |
294 |
295 |
--------------------------------------------------------------------------------
/PytestSessions/test_fixture_classes.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from webdriver_manager.chrome import ChromeDriverManager
3 | import pytest
4 | from webdriver_manager.firefox import GeckoDriverManager
5 |
6 |
7 | @pytest.fixture(scope='class')
8 | def init_chrome_driver(request):
9 | ch_driver = webdriver.Chrome(ChromeDriverManager().install())
10 | request.cls.driver = ch_driver
11 | yield
12 | ch_driver.close()
13 |
14 |
15 | @pytest.fixture(scope='class')
16 | def init_ff_driver(request):
17 | ff_driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
18 | request.cls.driver = ff_driver
19 | yield
20 | ff_driver.close()
21 |
22 |
23 | @pytest.mark.usefixtures("init_chrome_driver")
24 | class Base_Chrome_Test:
25 | pass
26 |
27 | class Test_Google_Chrome(Base_Chrome_Test):
28 |
29 | def test_google_title_chrome(self):
30 | self.driver.get("http://www.google.com")
31 | assert self.driver.title == "Google"
32 |
33 |
34 |
35 | @pytest.mark.usefixtures("init_ff_driver")
36 | class Base_Firefox_Test:
37 | pass
38 |
39 | class Test_Google_Firefox(Base_Firefox_Test):
40 |
41 | def test_google_title_firefox(self):
42 | self.driver.get("http://www.google.com")
43 | assert self.driver.title == "Google"
--------------------------------------------------------------------------------
/PytestSessions/test_fixture_params.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from webdriver_manager.chrome import ChromeDriverManager
3 | import pytest
4 | from webdriver_manager.firefox import GeckoDriverManager
5 |
6 |
7 | @pytest.fixture(params=["chrome", "firefox"],scope='class')
8 | def init__driver(request):
9 | if request.param == "chrome":
10 | web_driver = webdriver.Chrome(ChromeDriverManager().install())
11 | if request.param == "firefox":
12 | web_driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
13 | request.cls.driver = web_driver
14 | yield
15 | web_driver.close()
16 |
17 |
18 | @pytest.mark.usefixtures("init__driver")
19 | class BaseTest:
20 | pass
21 |
22 |
23 | class Test_Google(BaseTest):
24 |
25 | def test_google_title(self):
26 | self.driver.get("http://www.google.com")
27 | assert self.driver.title == "Google"
28 |
29 |
30 | def test_google_url(self):
31 | self.driver.get("http://www.google.com")
32 | assert self.driver.current_url == "https://www.google.com/?gws_rd=ssl"
33 |
34 |
--------------------------------------------------------------------------------
/PytestSessions/test_google_fixture.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from webdriver_manager.chrome import ChromeDriverManager
3 | import pytest
4 |
5 |
6 | driver = None
7 | @pytest.fixture(scope='module')
8 | def init_driver():
9 | global driver
10 | print("--------------------setup---------------")
11 | driver = webdriver.Chrome(ChromeDriverManager().install())
12 | driver.implicitly_wait(10)
13 | driver.delete_all_cookies()
14 | driver.get("http://www.google.com")
15 |
16 | yield
17 | print("--------------------tear down---------------")
18 | driver.quit()
19 |
20 |
21 | @pytest.mark.usefixtures("init_driver")
22 | def test_google_title():
23 | assert driver.title == "Google"
24 |
25 |
26 | @pytest.mark.usefixtures("init_driver")
27 | def test_google_url():
28 | assert driver.current_url == "https://www.google.com/?gws_rd=ssl"
29 |
30 |
--------------------------------------------------------------------------------
/PytestSessions/test_google_test.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from webdriver_manager.chrome import ChromeDriverManager
3 | import pytest
4 |
5 |
6 | driver = None
7 |
8 |
9 | def setup_module(module):
10 | global driver
11 | driver = webdriver.Chrome(ChromeDriverManager().install())
12 | driver.implicitly_wait(10)
13 | driver.delete_all_cookies()
14 | driver.get("http://www.google.com")
15 |
16 |
17 | def teardown_module(module):
18 | driver.quit()
19 |
20 |
21 | def test_google_title():
22 | assert driver.title == "Google"
23 |
24 |
25 | def test_google_url():
26 | assert driver.current_url == "https://www.google.com/?gws_rd=ssl"
27 |
28 |
--------------------------------------------------------------------------------
/PytestSessions/test_webpage_login.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 |
8 | def test_google():
9 | driver = webdriver.Chrome(ChromeDriverManager().install())
10 | driver.implicitly_wait(10)
11 | driver.get('http://www.google.com')
12 | driver.quit()
13 |
14 | def test_facebook():
15 | driver = webdriver.Chrome(ChromeDriverManager().install())
16 | driver.implicitly_wait(10)
17 | driver.get('http://www.facebook.com')
18 | assert driver.title == "Facebook – log in or sign up"
19 | driver.quit()
20 |
21 | def test_insta():
22 | driver = webdriver.Chrome(ChromeDriverManager().install())
23 | driver.implicitly_wait(10)
24 | driver.get('http://www.instagram.com')
25 | assert driver.title == "Instagram"
26 | driver.quit()
27 |
28 | def test_gmail():
29 | driver = webdriver.Chrome(ChromeDriverManager().install())
30 | driver.implicitly_wait(10)
31 | driver.get('http://www.gmail.com')
32 | assert driver.title == "Gmail"
33 | driver.quit()
34 |
35 |
36 | def test_rediff():
37 | driver = webdriver.Chrome(ChromeDriverManager().install())
38 | driver.implicitly_wait(10)
39 | driver.get('http://www.rediff.com')
40 | assert driver.title == "Rediff.com: News | Rediffmail | Stock Quotes | Shopping"
41 | driver.quit()
--------------------------------------------------------------------------------
/SeleniumSessions/AlertJSPopUp.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('https://mail.rediff.com/cgi-bin/login.cgi')
11 |
12 | driver.find_element(By.NAME, 'proceed').click()
13 | time.sleep(3)
14 |
15 | alert = driver.switch_to.alert
16 | print(alert.text)
17 | alert.accept() # accept it, click on Ok
18 | #alert.dismiss()#cancel the pop up
19 | #alert.send_keys('hi')
20 |
21 | driver.switch_to.default_content()
22 |
23 | time.sleep(3)
24 | driver.quit()
--------------------------------------------------------------------------------
/SeleniumSessions/AuthPopUpHandle.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('http://admin:admin@the-internet.herokuapp.com/basic_auth')
11 |
--------------------------------------------------------------------------------
/SeleniumSessions/BackAndForward.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('http://amazon.in')
11 |
12 | driver.find_element(By.LINK_TEXT, 'Best Sellers').click()
13 | time.sleep(2)
14 |
15 | driver.back()
16 | time.sleep(2)
17 |
18 | driver.forward()
19 | time.sleep(2)
20 |
21 | driver.back()
22 | time.sleep(2)
23 |
24 | driver.refresh()
25 |
26 | driver.quit()
--------------------------------------------------------------------------------
/SeleniumSessions/CerificateErrorHandle.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/CerificateErrorHandle.py
--------------------------------------------------------------------------------
/SeleniumSessions/CookiesConcept.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('https://www.reddit.com/')
11 | print(driver.get_cookies())
12 |
13 | driver.add_cookie({"name":"naveenpython","domain":"reddit.com","value":"python"})
14 |
15 | #print(driver.get_cookies())
16 |
17 |
18 | cookies = driver.get_cookies()
19 |
20 | for cook in cookies:
21 | print(cook)
22 |
23 |
--------------------------------------------------------------------------------
/SeleniumSessions/DataFile.xls:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/DataFile.xls
--------------------------------------------------------------------------------
/SeleniumSessions/DragAndDrop.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('https://jqueryui.com/resources/demos/droppable/default.html')
11 |
12 | '''drag and drop'''
13 | source = driver.find_element(By.ID, 'draggable')
14 | target = driver.find_element(By.ID, 'droppable')
15 |
16 | act_chains = ActionChains(driver)
17 | #act_chains.drag_and_drop(source,target).perform()
18 |
19 | act_chains\
20 | .click_and_hold(source)\
21 | .move_to_element(target)\
22 | .release()\
23 | .perform()
--------------------------------------------------------------------------------
/SeleniumSessions/DropDownHandle.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 | from selenium.webdriver.support.ui import Select
5 |
6 | import time
7 |
8 | driver = webdriver.Chrome(ChromeDriverManager().install())
9 | driver.implicitly_wait(10)
10 | driver.get("https://www.orangehrm.com/orangehrm-30-day-trial/")
11 |
12 |
13 | def select_values(element, value):
14 | select = Select(element)
15 | select.select_by_visible_text(value)
16 |
17 |
18 | def select_values_from_dropdown(dropDownOptionsList, value):
19 | print(len(dropDownOptionsList))
20 | for ele in dropDownOptionsList:
21 | print(ele.text)
22 | if ele.text == value:
23 | ele.click()
24 | break
25 |
26 |
27 |
28 | indus_options = driver.find_elements(By.XPATH, '//select[@id="Form_submitForm_Industry"]/option')
29 |
30 | select_values_from_dropdown(indus_options, 'Education')
31 | select_values_from_dropdown(indus_options, 'Travel')
32 |
33 | country_options = driver.find_elements(By.XPATH, '//select[@id="Form_submitForm_Country"]/option')
34 | select_values_from_dropdown(country_options, 'India')
35 |
36 |
37 |
38 | # ele_indus = driver.find_element(By.ID, 'Form_submitForm_Industry')
39 | # ele_country = driver.find_element(By.ID, 'Form_submitForm_Country')
40 | #
41 | # select_values(ele_indus, 'Education')
42 | # select_values(ele_country, 'India')
43 |
44 | #select = Select(ele_indus)
45 |
46 | #select.select_by_visible_text('Education')
47 | #select.select_by_index(4)
48 | #select.select_by_value('health')
49 |
50 | #print(select.is_multiple)
51 |
52 | #select_con = Select(ele_country)
53 | #select_con.select_by_visible_text('India')
54 |
55 | # select = Select(ele_indus)
56 | # indus_list = select.options
57 | #
58 | # for ele in indus_list:
59 | # print(ele.text)
60 | # if(ele.text == 'Automotive'):
61 | # ele.click()
62 | # break
63 |
64 |
65 |
--------------------------------------------------------------------------------
/SeleniumSessions/ElementActionsConcept.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('https://app.hubspot.com/login')
11 |
12 | username_ele = driver.find_element(By.ID, 'username')
13 | password_ele = driver.find_element(By.ID, 'password')
14 | login_button_ele = driver.find_element(By.ID, 'loginBtn')
15 |
16 | act_chains = ActionChains(driver)
17 | act_chains.send_keys_to_element(username_ele, 'batchautomation@gmail.com')
18 | act_chains.send_keys_to_element(password_ele, 'Test@12345')
19 | act_chains.click(login_button_ele).perform()
--------------------------------------------------------------------------------
/SeleniumSessions/ElementToBeClickableConcept.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/ElementToBeClickableConcept.py
--------------------------------------------------------------------------------
/SeleniumSessions/FileUploadHandle.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('https://cgi-lib.berkeley.edu/ex/fup.html')
11 |
12 | #type="file"
13 | driver.find_element(By.NAME, 'upfile').send_keys('/Users/NaveenKhunteta/Desktop/diagram.py')
14 |
15 | driver.find_element(By.XPATH, "//input[@type='submit']").click()
16 |
--------------------------------------------------------------------------------
/SeleniumSessions/HandleFrame.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('http://www.londonfreelance.org/courses/frames/index.html')
11 |
12 | #driver.switch_to.frame(2)
13 | #driver.switch_to.frame('main')
14 | frame_element = driver.find_element(By.NAME, 'main')
15 | driver.switch_to.frame(frame_element)
16 |
17 | headerValue = driver.find_element(By.CSS_SELECTOR, 'body > h2').text
18 | print(headerValue)
19 |
20 | driver.switch_to.default_content()
21 | driver.switch_to.parent_frame()
--------------------------------------------------------------------------------
/SeleniumSessions/HeadLessBrowsers.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | from webdriver_manager.firefox import GeckoDriverManager
6 | import time
7 |
8 | options = webdriver.ChromeOptions()
9 | options.headless = False
10 | options.add_argument('--incognito')
11 | driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
12 |
13 |
14 | # options = webdriver.FirefoxOptions()
15 | # options.headless = True
16 | # driver = webdriver.Firefox(executable_path=GeckoDriverManager().install(), options=options)
17 |
18 | driver.implicitly_wait(10)
19 |
20 | driver.get('http://amazon.in')
21 | print(driver.title)
--------------------------------------------------------------------------------
/SeleniumSessions/ImplicitWaitConcept.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/ImplicitWaitConcept.py
--------------------------------------------------------------------------------
/SeleniumSessions/JSConcept.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/JSConcept.py
--------------------------------------------------------------------------------
/SeleniumSessions/JavaScriptExecutorConcept.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/JavaScriptExecutorConcept.py
--------------------------------------------------------------------------------
/SeleniumSessions/JqueryDropDown.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 | from selenium.webdriver.support.ui import Select
5 |
6 | import time
7 |
8 |
9 | def select_values(options_list, value):
10 | if not value[0] == 'all':
11 | for ele in drop_list:
12 | print(ele.text)
13 | for k in range(len(value)):
14 | if ele.text == value[k]:
15 | ele.click()
16 | break
17 | else:
18 | try:
19 | for ele in options_list:
20 | ele.click()
21 | except Exception as e:
22 | print(e)
23 |
24 |
25 | driver = webdriver.Chrome(ChromeDriverManager().install())
26 | driver.implicitly_wait(10)
27 | driver.get("https://www.jqueryscript.net/demo/Drop-Down-Combo-Tree/")
28 | time.sleep(2)
29 |
30 | driver.find_element(By.ID, 'justAnInputBox').click()
31 |
32 | time.sleep(2)
33 |
34 | drop_list = driver.find_elements(By.CSS_SELECTOR, 'span.comboTreeItemTitle')
35 | values_list = ['choice 2', 'choice 3', 'choice 6 2 1']
36 | #values_list = ['choice 7']
37 | #values_list = ['all']
38 |
39 | select_values(drop_list, values_list)
40 | # select_values(drop_list, 'choice 3')
41 | # select_values(drop_list, 'choice 6 2 1')
42 |
43 |
44 |
45 | # for ele in drop_list:
46 | # print(ele.text)
47 | # if ele.text == 'choice 6 2 3':
48 | # ele.click()
49 | # break
50 |
--------------------------------------------------------------------------------
/SeleniumSessions/LocatorCSSClassName.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 |
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 | driver.get("https://app.hubspot.com/login")
10 |
11 | #driver.find_element(By.CSS_SELECTOR, '#username').send_keys("naveen30@gmail.com")
12 | # driver.find_element(By.CLASS_NAME,'login-email').send_keys("naveen@gmail.com")
13 | # driver.find_element(By.CLASS_NAME, 'login-password').send_keys("test@123")
14 | # driver.find_element(By.CLASS_NAME, 'login-submit').click()
15 |
16 | #driver.find_element(By.CSS_SELECTOR, 'input.form-control.private-form__control.login-email').send_keys("test@gmail.com")
17 | #driver.find_element(By.XPATH, "//input[@class='form-control private-form__control login-email']").send_keys("test@gmail.com")
18 |
19 | #driver.find_element(By.CLASS_NAME, 'form-control private-form__control login-email').send_keys("test@gmail.com")
20 |
21 | # form-control private-form__control login-email
22 | #form-control private-form__control login-password m-bottom-3
23 |
24 | #driver.find_element(By.LINK_TEXT, 'Sign up').click()
25 | #driver.find_element(By.PARTIAL_LINK_TEXT, 'Sign').click()
--------------------------------------------------------------------------------
/SeleniumSessions/LocatorsConcept.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 |
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 | driver.get("https://www.orangehrm.com/orangehrm-30-day-trial/")
10 |
11 | print(driver.title)
12 |
13 | username_url = driver.find_element(By.ID, 'Form_submitForm_subdomain')
14 | first_name = driver.find_element(By.ID, 'Form_submitForm_FirstName')
15 | last_name = driver.find_element(By.ID, 'Form_submitForm_LastName')
16 | email = driver.find_element(By.ID, 'Form_submitForm_Email')
17 | feature_link = driver.find_element(By.LINK_TEXT, 'Features')
18 |
19 | username_url.send_keys("naveenautomationlabs")
20 | first_name.send_keys("Naveen")
21 | last_name.send_keys("automationlabs")
22 | email.send_keys("naveen@gmail.com")
23 | feature_link.click()
24 |
--------------------------------------------------------------------------------
/SeleniumSessions/LocatorsName.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 |
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 | driver.get("https://classic.crmpro.com/")
10 |
11 | print(driver.title)
12 |
13 | username = driver.find_element(By.NAME, 'username')
14 | password = driver.find_element(By.NAME, 'password')
15 | login_button = driver.find_element(By.XPATH, "//input[@value='Login']")
16 |
17 | username.send_keys("batchautomation")
18 | password.send_keys("Test@12345")
19 | login_button.click()
--------------------------------------------------------------------------------
/SeleniumSessions/LocatorsTagName.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 |
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 | driver.get("https://www.freshworks.com/")
10 |
11 | header_element = driver.find_element(By.TAG_NAME, 'h1')
12 | print(header_element.text)
13 |
14 |
--------------------------------------------------------------------------------
/SeleniumSessions/MoveToElementConcept.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('https://www.spicejet.com/')
11 | time.sleep(3)
12 |
13 | '''move to element'''
14 | login_ele = driver.find_element(By.ID, 'ctl00_HyperLinkLogin')
15 | act_chains = ActionChains(driver)
16 | act_chains.move_to_element(login_ele).perform()
17 |
18 | spice_club_members_ele = driver.find_element(By.LINK_TEXT, 'SpiceClub Members')
19 | act_chains.move_to_element(spice_club_members_ele).perform()
20 |
21 | member_login_ele = driver.find_element(By.LINK_TEXT, 'Member Login')
22 | member_login_ele.click()
23 |
24 | time.sleep(3)
25 | driver.quit()
--------------------------------------------------------------------------------
/SeleniumSessions/ReadExcel.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/ReadExcel.py
--------------------------------------------------------------------------------
/SeleniumSessions/RightClick.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 |
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | driver.get('http://swisnl.github.io/jQuery-contextMenu/demo.html')
11 |
12 | '''right/context click'''
13 |
14 | right_click_ele = driver.find_element(By.XPATH, "//span[text()='right click me']")
15 | act_chain = ActionChains(driver)
16 | act_chain.context_click(right_click_ele).perform()
17 |
18 | right_click_options = driver.find_elements(By.CSS_SELECTOR, 'li.context-menu-icon span')
19 | for ele in right_click_options:
20 | print(ele.text)
21 | if ele.text == 'Copy':
22 | ele.click()
23 | break
24 |
25 |
26 |
--------------------------------------------------------------------------------
/SeleniumSessions/ScreenshotConcept.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | options = webdriver.ChromeOptions()
8 | options.headless = True
9 | driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
10 | driver.implicitly_wait(10)
11 |
12 | driver.get('https://www.reddit.com/')
13 | #driver.get_screenshot_as_file('reddit_1.png');
14 |
15 | '''full screenshot'''
16 | #make sure that you are running in headless mode
17 |
18 | S = lambda X: driver.execute_script('return document.body.parentNode.scroll'+X)
19 | driver.set_window_size(S('Width'), S('Height'))
20 | driver.find_element_by_tag_name('body').screenshot('reddit_full_1.png');
21 |
22 |
--------------------------------------------------------------------------------
/SeleniumSessions/TotalLinks.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 |
5 | import time
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 | driver.get("https://www.amazon.in/")
10 |
11 | linksList = driver.find_elements(By.TAG_NAME, 'a')
12 | print(len(linksList))
13 |
14 | for ele in linksList:
15 | link_text = ele.text
16 | if not (link_text == "" or link_text == None):
17 | print(link_text)
18 | print(ele.get_attribute('href'))
19 |
20 |
21 | imageList = driver.find_elements(By.TAG_NAME, 'img')
22 | print(len(imageList))
23 |
24 | for ele in imageList:
25 | print(ele.get_attribute('src'))
26 |
27 |
--------------------------------------------------------------------------------
/SeleniumSessions/WDBasics.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 | from webdriver_manager.firefox import GeckoDriverManager
5 |
6 | import time
7 |
8 | browser_name = "firefox"
9 | if browser_name == "chrome":
10 | options = webdriver.ChromeOptions()
11 | options.headless = True
12 | driver = webdriver.Chrome(executable_path="/Users/NaveenKhunteta/Downloads/chromedriver", options=options)
13 | #driver = webdriver.Chrome(ChromeDriverManager().install())
14 |
15 | elif browser_name == "firefox":
16 | #driver = webdriver.Firefox(executable_path="/Users/NaveenKhunteta/Downloads/geckodriver")
17 | options = webdriver.FirefoxOptions()
18 | options.headless = True
19 | driver = webdriver.Firefox(executable_path=GeckoDriverManager().install(), options= options)
20 | elif browser_name == "safari":
21 | driver = webdriver.Safari()
22 | else:
23 | print("Please pass the correct browser name : " + browser_name)
24 |
25 | driver.implicitly_wait(10)
26 | driver.get("http://www.google.com")
27 | print(driver.title)
28 | driver.find_element(By.NAME, 'q').send_keys("Naveen AutomationLabs")
29 | time.sleep(3)
30 |
31 | optionsList = driver.find_elements(By.CSS_SELECTOR,'ul.erkvQe li span')
32 | for s in optionsList:
33 | print(s.text)
34 |
35 | driver.close()
--------------------------------------------------------------------------------
/SeleniumSessions/WaitForAlertConcept.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/WaitForAlertConcept.py
--------------------------------------------------------------------------------
/SeleniumSessions/WaitForElementsConcept.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/WaitForElementsConcept.py
--------------------------------------------------------------------------------
/SeleniumSessions/WebDriverWaitConcept.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/WebDriverWaitConcept.py
--------------------------------------------------------------------------------
/SeleniumSessions/WebElement.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 | from webdriver_manager.firefox import GeckoDriverManager
5 |
6 | import time
7 |
8 | def enter_name(locator, value):
9 | driver.find_element(By.ID, locator).send_keys(value)
10 |
11 |
12 | def do_get_title():
13 | return driver.title
14 |
15 |
16 | if __name__ == "__main__":
17 | driver = webdriver.Chrome(ChromeDriverManager().install())
18 | driver.implicitly_wait(10)
19 | driver.get("https://www.orangehrm.com/orangehrm-30-day-trial/")
20 | print(do_get_title())
21 | enter_name("Form_submitForm_subdomain", "naveen")
22 |
--------------------------------------------------------------------------------
/SeleniumSessions/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/__init__.py
--------------------------------------------------------------------------------
/SeleniumSessions/calc.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 | from webdriver_manager.firefox import GeckoDriverManager
5 | from selenium.webdriver.common.action_chains import ActionChains
6 |
7 | import time
8 |
9 | browser_name = "chrome"
10 | if browser_name == "chrome":
11 | driver = webdriver.Chrome(ChromeDriverManager().install())
12 | driver.implicitly_wait(15)
13 | driver.get("https://www.westpac.co.nz/kiwisaver/calculators/kiwisaver-calculator/")
14 |
15 | driver.switch_to.frame(driver.find_element(By.CSS_SELECTOR, 'div#calculator-embed iframe'))
16 |
17 | ele = driver.find_element(By.XPATH, "//div[@class='control text-control']//input[@class='ng-pristine ng-valid']")
18 | ActionChains(driver).move_to_element(ele).send_keys("23").perform()
19 |
20 | driver.find_element(By.XPATH, "(//div[@class='well-value ng-binding'])[1]").click()
21 | empStatusList = driver.find_elements(By.CSS_SELECTOR, "ul.option-list li div.label span")
22 | for ele in empStatusList:
23 | print(ele.text)
24 | if ele.text == "Self-employed":
25 | ele.click()
26 | break
--------------------------------------------------------------------------------
/SeleniumSessions/cert.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/cert.py
--------------------------------------------------------------------------------
/SeleniumSessions/cookies.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 | import time
6 |
7 | options = webdriver.ChromeOptions()
8 | options.headless = True
9 | driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
10 | driver.implicitly_wait(10)
11 |
12 | driver.get('https://reddit.com')
13 | print(driver.get_cookies())
14 |
15 | driver.add_cookie({"name":"python","domain":"reddit.com","value":"python"})
16 | print(driver.get_cookies())
17 | print(driver.get_cookie('domain'))
18 |
19 | driver.delete_all_cookies()
20 |
21 | print(driver.get_cookies())
22 | #driver.get_screenshot_as_file("screenshot.png")
23 |
24 | S = lambda X: driver.execute_script('return document.body.parentNode.scroll'+X)
25 | driver.set_window_size(S('Width'),S('Height')) # May need manual adjustment
26 | driver.find_element_by_tag_name('body').screenshot('web_screenshot.png')
27 |
28 |
29 | # cookies = driver.get_cookies()
30 | # for cook in cookies:
31 | # print(cook)
32 |
33 |
34 | driver.quit()
--------------------------------------------------------------------------------
/SeleniumSessions/different_waits:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/different_waits
--------------------------------------------------------------------------------
/SeleniumSessions/excel:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/excel
--------------------------------------------------------------------------------
/SeleniumSessions/full_screen_reddit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/full_screen_reddit.png
--------------------------------------------------------------------------------
/SeleniumSessions/geckodriver.log:
--------------------------------------------------------------------------------
1 | 1593702523158 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofilePRacvr"
2 | 1593702526523 Marionette INFO Listening on port 58084
3 | 1593702526621 Marionette WARN TLS certificate errors will be ignored for this session
4 | 1593702527375 Marionette INFO Stopped listening on port 58084
5 | 1593828220248 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileRFsw9L"
6 | 1593828223615 Marionette INFO Listening on port 60565
7 | 1593828223638 Marionette WARN TLS certificate errors will be ignored for this session
8 | 1593828228182 Marionette INFO Stopped listening on port 60565
9 | 1593828742040 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofilepircI3"
10 | 1593828745107 Marionette INFO Listening on port 60713
11 | 1593828745197 Marionette WARN TLS certificate errors will be ignored for this session
12 | 1593828759012 Marionette INFO Stopped listening on port 60713
13 | 1593828786048 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileRIUjnj"
14 | 1593828790244 Marionette INFO Listening on port 60790
15 | 1593828790339 Marionette WARN TLS certificate errors will be ignored for this session
16 | 1593828796681 Marionette INFO Stopped listening on port 60790
17 | 1594664276967 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofile1Uoiaq"
18 | 1594664280341 Marionette INFO Listening on port 57111
19 | 1594664280410 Marionette WARN TLS certificate errors will be ignored for this session
20 | 1594664294397 Marionette INFO Stopped listening on port 57111
21 | 1594664302923 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofile6N4HIN"
22 | *** You are running in headless mode.
23 | 1594664305399 Marionette INFO Listening on port 57298
24 | 1594664305431 Marionette WARN TLS certificate errors will be ignored for this session
25 | 1594664309786 Marionette INFO Stopped listening on port 57298
26 | 1594664730473 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofile4wJXlD"
27 | *** You are running in headless mode.
28 | 1594664732905 Marionette INFO Listening on port 59236
29 | 1594664732984 Marionette WARN TLS certificate errors will be ignored for this session
30 | 1594664762772 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/var/folders/fd/lw5s91x96f947xsp40gd_2180000gp/T/rust_mozprofileuloEF4"
31 | *** You are running in headless mode.
32 | 1594664765595 Marionette INFO Listening on port 59500
33 | 1594664765614 Marionette WARN TLS certificate errors will be ignored for this session
34 | 1594664769932 Marionette INFO Stopped listening on port 59500
35 |
--------------------------------------------------------------------------------
/SeleniumSessions/login.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.common.by import By
3 | from webdriver_manager.chrome import ChromeDriverManager
4 | from webdriver_manager.firefox import GeckoDriverManager
5 |
6 | import time
7 |
8 | browser_name = "opera"
9 | if browser_name == "chrome":
10 | #driver = webdriver.Chrome(executable_path="/Users/NaveenKhunteta/Downloads/chromedriver")
11 | driver = webdriver.Chrome(ChromeDriverManager().install())
12 |
13 | elif browser_name == "firefox":
14 | #driver = webdriver.Firefox(executable_path="/Users/NaveenKhunteta/Downloads/geckodriver")
15 | driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
16 | elif browser_name == "safari":
17 | driver = webdriver.Safari()
18 | else:
19 | print("Please pass the correct browser name : " + browser_name)
20 | raise Exception('driver is not found')
21 |
22 | driver.implicitly_wait(10)
23 | driver.get("https://app.hubspot.com/login")
24 |
25 | driver.find_element(By.ID, 'username').send_keys('naveenanimation30@gmail.com')
26 | driver.find_element(By.ID, 'password').send_keys('Test@12345678')
27 | driver.find_element(By.ID, 'loginBtn').click()
--------------------------------------------------------------------------------
/SeleniumSessions/reddit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/reddit.png
--------------------------------------------------------------------------------
/SeleniumSessions/reddit_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/reddit_1.png
--------------------------------------------------------------------------------
/SeleniumSessions/reddit_full_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/reddit_full_1.png
--------------------------------------------------------------------------------
/SeleniumSessions/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/screenshot.png
--------------------------------------------------------------------------------
/SeleniumSessions/switchTo.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver import ActionChains
3 | from selenium.webdriver.common.by import By
4 | from webdriver_manager.chrome import ChromeDriverManager
5 |
6 |
7 | driver = webdriver.Chrome(ChromeDriverManager().install())
8 | driver.implicitly_wait(10)
9 |
10 | '''frame handle'''
11 | # driver.get('http://www.londonfreelance.org/courses/frames/index.html')
12 | # frame_element = driver.find_element(By.NAME, 'main')
13 | # #driver.switch_to.frame(frame_element)
14 | # #driver.switch_to.frame(2)
15 | # driver.switch_to.frame('main')
16 | # header = driver.find_element(By.CSS_SELECTOR, 'body > h2').text
17 | # print(header)
18 |
19 |
20 | '''pop up handle'''
21 | # driver.get('https://mail.rediff.com/cgi-bin/login.cgi')
22 | # driver.find_element(By.NAME, 'proceed').click()
23 | # alert = driver.switch_to.alert
24 | # print(alert.text)
25 | # alert.accept()
26 |
27 | '''auth pop up'''
28 | #driver.get('http://admin:admin@the-internet.herokuapp.com/basic_auth')
29 |
30 | '''file upload pop up'''
31 | driver.get('https://cgi-lib.berkeley.edu/ex/fup.html')
32 | driver.find_element(By.NAME, 'upfile').send_keys('/Users/NaveenKhunteta/Desktop/MyWork.xml')
33 |
34 |
35 |
--------------------------------------------------------------------------------
/SeleniumSessions/web_screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/naveenanimation20/Selenium-Python-TutorialsCode/178e9c0dd775a852d7daacbefa30e6625766db0c/SeleniumSessions/web_screenshot.png
--------------------------------------------------------------------------------