-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSeleniumPythonEasyDemoExcelReadWrite.py
More file actions
1701 lines (1343 loc) · 58.1 KB
/
SeleniumPythonEasyDemoExcelReadWrite.py
File metadata and controls
1701 lines (1343 loc) · 58.1 KB
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
307
308
309
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
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.action_chains import ActionChains
import xlsxwriter
import openpyxl
import time
browser = webdriver.Chrome("C:/browserdrivers/chromedriver.exe");
browser.get('http://demo.seleniumeasy.com/');
browser.maximize_window();
mysecs = 3;
time.sleep(mysecs);
myworkbook = openpyxl.load_workbook('C:/test/test.xlsx')
mysheet = myworkbook['Sheet1']
# Open Simple Form Demo screen
InputForms = browser.find_element_by_link_text("Input Forms");
InputForms.click();
InputForms.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Simple Form Demo").click();
#input1 = "This is the first input box";
input1 = "This is the first input box"
browser.find_element_by_id("user-message").send_keys(input1);
browser.find_element_by_css_selector("button.btn:nth-child(2)").click();
output1 = browser.find_element_by_id("display");
a1 = output1.text
if (input1 in output1.text):
print("Your Input text matched");
print("The input expected: " + input1);
print("The input shown: " + a1);
else:
print("Your Input text did not match");
print("The input expected: " + input1);
print("The input shown: " + a1);
num1 = mysheet['A1'].value
num2 = mysheet['A2'].value
sum1 = num1 + num2;
msum1 = str(sum1);
browser.find_element_by_id("sum1").send_keys(num1);
browser.find_element_by_id("sum2").send_keys(num2);
browser.find_element_by_css_selector("button.btn:nth-child(3)").click();
output2 = browser.find_element_by_id("displayvalue");
a2 = output2.text
if (msum1 in output2.text):
print("The sum is correct");
print("The sum expected: " + msum1);
print("The sum calculated: " + a2);
else:
print("The sum is not correct");
print("The sum expected: " + msum1);
print("The sum calculated: " + a2);
#return from Simple Form Demo to Main Page
browser.back();
time.sleep(mysecs);
#Open CheckBox Demo screen
InputForms2 = browser.find_element_by_link_text("Input Forms");
InputForms2.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Checkbox Demo").click();
#Click On Checkbox
browser.find_element_by_id("isAgeSelected").click();
# Verify expected text
input3 = "Success - Check box is checked";
output3 = browser.find_element_by_id("txtAge");
a3 = output3.text
if (input3 in output3.text):
print("Your Input text matched");
print("The input expected: " + input3);
print("The input shown: " + a3);
else:
print("Your Input text did not match");
print("The input expected: " + input3);
print("The input shown: " + a3);
#Uncheck the checkbox
browser.find_element_by_id("isAgeSelected").click();
#4 checkboxes test
buttonchecktext = browser.find_element_by_id("check1");
checkBox1 = browser.find_element_by_xpath("//label[contains(.,'Option 1')]");
checkBox2 = browser.find_element_by_xpath("//label[contains(.,'Option 2')]");
checkBox3 = browser.find_element_by_xpath("//label[contains(.,'Option 3')]");
checkBox4 = browser.find_element_by_xpath("//label[contains(.,'Option 4')]");
if (not(checkBox1.is_selected())) and (not(checkBox2.is_selected())) and (not(checkBox3.is_selected())) and (not(checkBox4.is_selected())):
print("No checkboxes selected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
if (not(checkBox1.is_selected())):
checkBox1.click();
print("1st checkbox is selected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
if (not(checkBox2.is_selected())):
checkBox2.click();
print("1st and 2nd checkboxes selected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
if (not(checkBox3.is_selected())):
checkBox3.click();
print("1st, 2nd, and 3rd checkboxes selected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
if (not(checkBox4.is_selected())):
checkBox4.click();
print("1st, 2nd, 3rd, and 4th checkboxes selected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
checkBox1.click();
print("1st checkbox is deselected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
checkBox2.click();
print("1st and 2nd checkbox deselected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
checkBox3.click();
print("1st, 2nd, and 3rd checkbox deselected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
checkBox4.click();
print("1st, 2nd, 3rd, and 4th checkbox deselected: ");
print("The button text: " + buttonchecktext.get_attribute("value"));
#return from Checkbox Demo to Main Page
browser.back();
time.sleep(mysecs);
#Open Radio Buttons Demo screen
InputForms3 = browser.find_element_by_link_text("Input Forms");
InputForms3.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Radio Buttons Demo").click();
#Verify expected text for male checkbox
out1 = mysheet['B1'].value
out2 = mysheet['B2'].value
radio1 = browser.find_element_by_xpath("(//label[@class='radio-inline'][contains(.,'Male')])[1]");
radio2 = browser.find_element_by_xpath("(//label[@class='radio-inline'][contains(.,'Female')])[1]");
checkbutton1 = browser.find_element_by_id("buttoncheck");
checkmessage = browser.find_element_by_xpath("//p[@class='radiobutton']");
radio1.click();
checkbutton1.click();
a5 = checkmessage.text
if (out1 in checkmessage.text):
print("The output expected: " + out1);
print("The output shown: " + a5);
else:
print("The output expected: " + out1);
print("The output shown: " + a5);
radio2.click();
checkbutton1.click();
a6 = checkmessage.text
if (out2 in checkmessage.text):
print("The output expected: " + out2);
print("The output shown: " + a6);
else:
print("The output expected: " + out2);
print("The output shown: " + a6);
abc1 = "Sex : Male";
abc2 = "Sex : Female";
abc3 = "Age group: 0 - 5";
abc4 = "Age group: 5 - 15";
abc5 = "Age group: 15 - 50";
sexmale = browser.find_element_by_xpath("(//label[@class='radio-inline'][contains(.,'Male')])[2]");
sexfemale = browser.find_element_by_xpath("(//label[@class='radio-inline'][contains(.,'Female')])[2]");
age0to5 = browser.find_element_by_xpath("//input[@value='0 - 5']");
age5to15 = browser.find_element_by_xpath("//input[@value='5 - 15']");
age15to50 = browser.find_element_by_xpath("//input[@value='15 - 50']");
checkbutton2 = browser.find_element_by_xpath("//button[@type='button'][contains(.,'Get values')]");
checkmessage2 = browser.find_element_by_xpath("//p[@class='groupradiobutton']");
sexmale.click();
age0to5.click();
checkbutton2.click();
if (abc1 in checkmessage2.text) and (abc3 in checkmessage2.text):
print("The output expected: " + "\n" + abc1 + "\n" + abc3);
print("The output shown: " + checkmessage2.text);
else:
print("The output expected: " + "\n" + abc1 + "\n" + abc3);
print("The output shown: " + checkmessage2.text);
sexmale.click();
age5to15.click();
checkbutton2.click();
if (abc1 in checkmessage2.text) and (abc4 in checkmessage2.text):
print("The output expected: " + "\n" + abc1 + "\n" + abc4);
print("The output shown: " + checkmessage2.text);
else:
print("The output expected: " + "\n" + abc1 + "\n" + abc4);
print("The output shown: " + checkmessage2.text);
sexmale.click();
age15to50.click();
checkbutton2.click();
if (abc1 in checkmessage2.text) and (abc5 in checkmessage2.text):
print("The output expected: " + "\n" + abc1 + "\n" + abc5);
print("The output shown: " + checkmessage2.text);
else:
print("The output expected: " + "\n" + abc1 + "\n" + abc5);
print("The output shown: " + checkmessage2.text);
sexfemale.click();
age0to5.click();
checkbutton2.click();
if (abc2 in checkmessage2.text) and (abc3 in checkmessage2.text):
print("The output expected: " + "\n" + abc2 + "\n" + abc3);
print("The output shown: " + checkmessage2.text);
else:
print("The output expected: " + "\n" + abc2 + "\n" + abc3);
print("The output shown: " + checkmessage2.text);
sexfemale.click();
age5to15.click();
checkbutton2.click();
if (abc2 in checkmessage2.text) and (abc4 in checkmessage2.text):
print("The output expected: " + "\n" + abc2 + "\n" + abc4);
print("The output shown: " + checkmessage2.text);
else:
print("The output expected: " + "\n" + abc2 + "\n" + abc4);
print("The output shown: " + checkmessage2.text);
sexfemale.click();
age15to50.click();
checkbutton2.click();
if (abc2 in checkmessage2.text) and (abc5 in checkmessage2.text):
print("The output expected: " + "\n" + abc2 + "\n" + abc5);
print("The output shown: " + checkmessage2.text);
else:
print("The output expected: " + "\n" + abc2 + "\n" + abc5);
print("The output shown: " + checkmessage2.text);
#return from Radio Buttons Demo to Main Page
browser.back();
time.sleep(mysecs);
#Open Select Dropdown List screen
InputForms4 = browser.find_element_by_link_text("Input Forms");
InputForms4.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Select Dropdown List").click();
expm1 = mysheet['C1'].value
dropdown1 = browser.find_element_by_id("select-demo");
checkmessage3 = browser.find_element_by_class_name("selected-value");
Select(dropdown1).select_by_value("Wednesday");
a7 = checkmessage3.text
if (expm1 in checkmessage3.text):
print("The output expected: " + expm1);
print("The output shown: " + a7);
else:
print("The output expected: " + expm1);
print("The output shown: " + a7);
state1 = mysheet['C3'].value
state2 = mysheet['C4'].value
state3 = mysheet['C5'].value
state4 = mysheet['C6'].value
state5 = mysheet['C7'].value
state6 = mysheet['C8'].value
state7 = mysheet['C9'].value
state8 = mysheet['C10'].value
MultiSelect = browser.find_element_by_id("multi-select");
FirstSelectedButton = browser.find_element_by_id("printMe");
GetAllSelectedButton = browser.find_element_by_id("printAll");
checkmsg1 = browser.find_element_by_class_name("getall-selected");
frstoutstate1 = mysheet['C11'].value
frstoutstate2 = mysheet['C12'].value
frstoutstate3 = mysheet['C13'].value
frstoutstate4 = mysheet['C14'].value
frstoutstate5 = mysheet['C15'].value
frstoutstate6 = mysheet['C16'].value
frstoutstate7 = mysheet['C17'].value
frstoutstate8 = mysheet['C18'].value
optoutstate1 = mysheet['C19'].value
optoutstate2 = mysheet['C20'].value
optoutstate3 = mysheet['C21'].value
optoutstate4 = mysheet['C22'].value
optoutstate5 = mysheet['C23'].value
optoutstate6 = mysheet['C24'].value
optoutstate7 = mysheet['C25'].value
optoutstate8 = mysheet['C26'].value
Select(MultiSelect).select_by_value(state1);
FirstSelectedButton.click();
a8 = checkmsg1.text
if (state1 in checkmsg1.text):
print("The output expected: " + frstoutstate1);
print("The output shown: " + a8);
else:
print("The output expected: " + frstoutstate1);
print("The output shown: " + a8);
GetAllSelectedButton.click();
a9 = checkmsg1.text
if (state1 in checkmsg1.text):
print("The output expected: " + frstoutstate1);
print("The output shown: " + a9);
else:
print("The output expected: " + frstoutstate1);
print("The output shown: " + a9);
MultiSelect.send_keys(Keys.SHIFT);
Select(MultiSelect).select_by_value(state2);
FirstSelectedButton.click();
if (state2 in checkmsg1.text):
print("The output expected: " + frstoutstate1 + optoutstate2);
print("The output shown: " + checkmsg1.text);
else:
print("The output expected: " + frstoutstate1 + optoutstate2);
print("The output shown: " + checkmsg1.text);
GetAllSelectedButton.click();
if (state2 in checkmsg1.text):
print("The output expected: " + frstoutstate1 + "\n" + optoutstate2);
print("The output shown: " + checkmsg1.text);
else:
print("The output expected: " + frstoutstate1 + "\n" + optoutstate2);
print("The output shown: " + checkmsg1.Text);
#return from Select Dropdown List to Main Page
browser.back();
time.sleep(mysecs);
#Open Input Form Submit screen
InputForms5 = browser.find_element_by_link_text("Input Forms");
InputForms5.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Input Form Submit").click();
firstname = mysheet['D1'].value
lastname = mysheet['D2'].value
email = mysheet['D3'].value
phone = mysheet['D4'].value
address = mysheet['D5'].value
city = mysheet['D6'].value
zipcode = mysheet['D7'].value
websiteurl = mysheet['D8'].value
mycomment = mysheet['D9'].value
browser.find_element_by_name("first_name").send_keys(firstname);
browser.find_element_by_name("last_name").send_keys(lastname);
browser.find_element_by_name("email").send_keys(email);
browser.find_element_by_name("phone").send_keys(phone);
browser.find_element_by_name("address").send_keys(address);
browser.find_element_by_name("city").send_keys(city);
mystate1 = browser.find_element_by_css_selector("select.form-control");
Select(mystate1).select_by_visible_text("Pennsylvania");
browser.find_element_by_name("zip").send_keys(zipcode);
browser.find_element_by_name("website").send_keys(websiteurl);
radio11 = browser.find_element_by_xpath("//input[contains(@value,'yes')]");
radio21 = browser.find_element_by_xpath("//input[contains(@value,'no')]");
radio11.click();
radio21.click();
browser.find_element_by_name("comment").send_keys(mycomment);
mybtn11 = browser.find_element_by_xpath("//button[contains(@type,'submit')]");
mybtn11.click();
#Open Ajax Form Submit screen
InputForms6 = browser.find_element_by_link_text("Input Forms");
InputForms6.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Ajax Form Submit").click();
myname = mysheet['E1'].value
mytextarea = mysheet['E2'].value
browser.find_element_by_id("title").send_keys(myname);
browser.find_element_by_id("description").send_keys(mytextarea);
mysubmitbtn = browser.find_element_by_id("btn-submit");
mysubmitbtn.click();
expsubmittext = mysheet['E3'].value
mysubmittext = browser.find_element_by_id("submit-control");
time.sleep(mysecs);
a10 = mysubmittext.text
if (expsubmittext in mysubmittext.text):
print("The output expected: " + expsubmittext);
print("The output shown: " + a10);
else:
print("The output expected: " + expsubmittext);
print("The output shown: " + a10);
#Open Ajax Form Submit screen
InputForms7 = browser.find_element_by_link_text("Input Forms");
InputForms7.send_keys(Keys.DOWN);
browser.find_element_by_link_text("JQuery Select dropdown").click();
mysearch = "n";
SelectCountry = browser.find_element_by_xpath("(//span[contains(@class,'select2-selection__arrow')])[1]");
SelectCountry.click();
searchCountry = browser.find_element_by_xpath("(//input[contains(@class,'select2-search__field')])[2]");
searchCountry.send_keys(mysearch);
searchCountry.send_keys(Keys.ENTER);
SelectCountry.click();
browser.find_element_by_xpath("//li[contains(.,'Netherlands')]").click();
SelectState = browser.find_element_by_xpath("//input[@class='select2-search__field']");
SelectState.click();
browser.find_element_by_xpath("//li[contains(.,'Pennsylvania')]").click();
SelectUSOutlyingTerritories = browser.find_element_by_xpath("(//span[contains(@class,'select2-selection__arrow')])[2]");
SelectUSOutlyingTerritories.click();
mysearchterritories = "g";
searchUSOutlyingTerritories = browser.find_element_by_xpath("(//input[contains(@class,'select2-search__field')])[2]");
searchUSOutlyingTerritories.send_keys(mysearchterritories);
searchUSOutlyingTerritories.send_keys(Keys.ENTER);
SelectUSOutlyingTerritories.click();
browser.find_element_by_xpath("//li[contains(.,'Virgin Islands')]").click();
Selectfile = browser.find_element_by_id("files");
Selectfile.click();
Selectfile.send_keys(Keys.DOWN);
Selectfile.send_keys(Keys.ENTER);
Selectfile.send_keys(Keys.DOWN);
Selectfile.send_keys(Keys.DOWN);
Selectfile.send_keys(Keys.DOWN);
Selectfile.send_keys(Keys.DOWN);
Selectfile.send_keys(Keys.DOWN);
Selectfile.send_keys(Keys.DOWN);
Selectfile.send_keys(Keys.ENTER);
#Open Bootstrap Date Picker screen
InputForms8 = browser.find_element_by_link_text("Date pickers");
InputForms8.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Bootstrap Date Picker").click();
browser.find_element_by_xpath("//i[contains(@class,'glyphicon glyphicon-th')]").click();
browser.find_element_by_xpath("(//td[contains(.,'14')])[1]").click();
browser.find_element_by_xpath("//i[contains(@class,'glyphicon glyphicon-th')]").click();
browser.find_element_by_xpath("(//th[contains(.,'Today')])[1]").click();
browser.find_element_by_xpath("//i[contains(@class,'glyphicon glyphicon-th')]").click();
browser.find_element_by_xpath("(//th[contains(.,'Clear')])[1]").click();
browser.find_element_by_xpath("//i[contains(@class,'glyphicon glyphicon-th')]").click();
browser.find_element_by_xpath("(//td[contains(.,'30')])[1]").click();
browser.find_element_by_xpath("//input[contains(@placeholder,'Start date')]").click();
browser.find_element_by_xpath("(//td[contains(.,'4')])[2]").click();
browser.find_element_by_xpath("//input[contains(@placeholder,'End date')]").click();
browser.find_element_by_xpath("(//td[contains(.,'20')])[1]").click();
#Open JQuery Date Picker screen
InputForms9 = browser.find_element_by_link_text("Date pickers");
InputForms9.send_keys(Keys.DOWN);
browser.find_element_by_link_text("JQuery Date Picker").click();
browser.find_element_by_xpath("//input[contains(@name,'from')]").click();
browser.find_element_by_xpath("(//a[contains(.,'3')])[2]").click();
browser.find_element_by_xpath("//input[contains(@name,'to')]").click();
browser.find_element_by_xpath("//a[contains(.,'24')]").click();
#Open Table Pagination screen
InputForms10 = browser.find_element_by_link_text("Table");
InputForms10.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Table Pagination").click();
browser.find_element_by_xpath("//a[contains(.,'2')]").click();
browser.find_element_by_xpath("//a[contains(.,'3')]").click();
browser.find_element_by_xpath("//a[contains(.,'2')]").click();
browser.find_element_by_xpath("//a[contains(.,'1')]").click();
browser.find_element_by_xpath("//a[contains(@class,'next_link')]").click();
browser.find_element_by_xpath("//a[contains(@class,'next_link')]").click();
browser.find_element_by_xpath("//a[contains(@class,'prev_link')]").click();
browser.find_element_by_xpath("//a[contains(@class,'prev_link')]").click();
#Open Table Data Search screen
InputForms11 = browser.find_element_by_link_text("Table");
InputForms11.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Table Data Search").click();
mytest1 = mysheet['F1'].value
mytest2 = mysheet['F2'].value
mytest3 = mysheet['F3'].value
InputBox1 = browser.find_element_by_xpath("//input[contains(@data-action,'filter')]");
InputBox1.click();
InputBox1.send_keys(mytest1);
InputBox1.send_keys(Keys.ENTER);
OutBox1 = browser.find_element_by_xpath("//td[contains(.,'Wireframes')]");
a11 = OutBox1.text
if (mytest1 in OutBox1.text):
print("The output expected: " + mytest1);
print("The output shown: " + a11);
else:
print("The output expected: " + mytest1);
print("The output shown: " + a11);
InputBox1.clear();
InputBox1.send_keys(mytest2);
InputBox1.send_keys(Keys.ENTER);
OutBox2 = browser.find_element_by_xpath("//td[contains(.,'Jane Doe')]");
a12 = OutBox2.text
if (mytest2 in OutBox2.text):
print("The output expected: " + mytest2);
print("The output shown: " + a12);
else:
print("The output expected: " + mytest2);
print("The output shown: " + a12);
InputBox1.clear();
InputBox1.send_keys(mytest3);
InputBox1.send_keys(Keys.ENTER);
OutBox3 = browser.find_element_by_xpath("//td[contains(.,'completed')]");
a13 = OutBox3.text
if (mytest3 in OutBox3.text):
print("The output expected: " + mytest3);
print("The output shown: " + a13);
else:
print("The output expected: " + mytest3);
print("The output shown: " + a13);
InputBox1.clear();
InputBox1.send_keys(Keys.ENTER);
browser.find_element_by_xpath("//button[contains(.,'Filter')]").click();
mytest4 = mysheet['F4'].value
mytest5 = mysheet['F5'].value
mytest6 = mysheet['F6'].value
mytest7 = mysheet['F7'].value
InputBox11 = browser.find_element_by_xpath("//input[contains(@placeholder,'#')]");
InputBox11.click();
InputBox11.send_keys(mytest4);
InputBox11.send_keys(Keys.ENTER);
OutBox11 = browser.find_element_by_xpath("(//td[contains(.,'3')])[3]");
a14 = OutBox11.text
if (str(mytest4) in OutBox11.text):
print("The output expected: " + str(mytest4));
print("The output shown: " + a14);
else:
print("The output expected: " + str(mytest4));
print("The output shown: " + a14);
InputBox11.clear();
InputBox12 = browser.find_element_by_xpath("//input[contains(@placeholder,'Username')]");
InputBox12.click();
InputBox12.send_keys(mytest5);
InputBox12.send_keys(Keys.ENTER);
OutBox12 = browser.find_element_by_xpath("//td[contains(.,'jacobs')]");
a15 = OutBox12.text
if (mytest5 in OutBox12.text):
print("The output expected: " + mytest5);
print("The output shown: " + a15);
else:
print("The output expected: " + mytest5);
print("The output shown: " + a15);
InputBox12.clear();
InputBox13 = browser.find_element_by_xpath("//input[contains(@placeholder,'First Name')]");
InputBox13.click();
InputBox13.send_keys(mytest6);
InputBox13.send_keys(Keys.ENTER);
OutBox13 = browser.find_element_by_xpath("//td[contains(.,'Byron')]");
a16 = OutBox13.text
if (mytest6 in OutBox13.text):
print("The output expected: " + mytest6);
print("The output shown: " + a16);
else:
print("The output expected: " + mytest6);
print("The output shown: " + a16);
InputBox13.clear();
InputBox14 = browser.find_element_by_xpath("//input[contains(@placeholder,'Last Name')]");
InputBox14.click();
InputBox14.send_keys(mytest7);
InputBox13.send_keys(Keys.ENTER);
OutBox14 = browser.find_element_by_xpath("//td[contains(.,'Samuels')]");
a17 = OutBox14.text
if (mytest7 in OutBox14.text):
print("The output expected: " + mytest7);
print("The output shown: " + a17);
else:
print("The output expected: " + mytest7);
print("The output shown: " + a17);
InputBox14.clear();
#Open Table Filter screen
InputForms12 = browser.find_element_by_link_text("Table");
InputForms12.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Table Filter").click();
greenbtn = browser.find_element_by_xpath("//button[contains(.,'Green')]");
orangebtn = browser.find_element_by_xpath("//button[contains(.,'Orange')]");
redbtn = browser.find_element_by_xpath("//button[contains(.,'Red')]");
allbtn = browser.find_element_by_xpath("//button[contains(.,'All')]");
check1 = browser.find_element_by_css_selector(".table > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > div:nth-child(1) > a:nth-child(1) > i:nth-child(1)");
check2 = browser.find_element_by_css_selector(".table > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(3) > div:nth-child(1) > a:nth-child(1) > i:nth-child(1)");
check3 = browser.find_element_by_css_selector(".table > tbody:nth-child(1) > tr:nth-child(3) > td:nth-child(3) > div:nth-child(1) > a:nth-child(1) > i:nth-child(1)");
check4 = browser.find_element_by_css_selector(".table > tbody:nth-child(1) > tr:nth-child(4) > td:nth-child(3) > div:nth-child(1) > a:nth-child(1) > i:nth-child(1)");
check5 = browser.find_element_by_css_selector(".table > tbody:nth-child(1) > tr:nth-child(5) > td:nth-child(3) > div:nth-child(1) > a:nth-child(1) > i:nth-child(1)");
time.sleep(mysecs);
greenbtn.click();
print("Click Green Button: ");
print("check1 green should be shown: " + str(check1.is_displayed()));
print("check2 orange should be hidden: " + str(check2.is_displayed()));
print("check3 red should be hidden: " + str(check3.is_displayed()));
print("check4 green should be shown: " + str(check4.is_displayed()));
print("check5 orange should be hidden: " + str(check5.is_displayed()));
time.sleep(mysecs);
orangebtn.click();
print("Click Orange Button: ");
print("check1 green should be hidden: " + str(check1.is_displayed()));
print("check2 orange should be shown: " + str(check2.is_displayed()));
print("check3 red should be hidden: " + str(check3.is_displayed()));
print("check4 green should be hidden: " + str(check4.is_displayed()));
print("check5 orange should be shown: " + str(check5.is_displayed()));
time.sleep(mysecs);
redbtn.click();
print("Click Red Button: ");
print("check1 green should be hidden: " + str(check1.is_displayed()));
print("check2 orange should be hidden: " + str(check2.is_displayed()));
print("check3 red should be shown: " + str(check3.is_displayed()));
print("check4 green should be hidden: " + str(check4.is_displayed()));
print("check5 orange should be hidden: " + str(check5.is_displayed()));
time.sleep(mysecs);
allbtn.click();
print("Click All Button: ");
print("check1 green should be shown: " + str(check1.is_displayed()));
print("check2 orange should be shown: " + str(check2.is_displayed()));
print("check3 red should be shown: " + str(check3.is_displayed()));
print("check4 green should be shown: " + str(check4.is_displayed()));
print("check5 orange should be shown: " + str(check5.is_displayed()));
time.sleep(mysecs);
#Open Table Sort & Search screen
InputForms13 = browser.find_element_by_link_text("Table");
InputForms13.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Table Sort & Search").click();
mymessage1 = mysheet['G1'].value
mymessage2 = mysheet['G2'].value
mymessage3 = mysheet['G3'].value
browser.find_element_by_xpath("//select[contains(@name,'length')]").send_keys("50");
browser.find_element_by_xpath("//select[contains(@name,'length')]").click();
time.sleep(mysecs);
mymessagebox = browser.find_element_by_xpath("//div[@class='dataTables_info']");
a18 = mymessagebox.text
if (mymessage1 in mymessagebox.text):
print("The output expected: " + mymessage1);
print("The output shown: " + a18);
else:
print("The output expected: " + mymessage1);
print("The output shown: " + a18);
time.sleep(mysecs);
browser.find_element_by_xpath("//select[contains(@name,'length')]").send_keys("25");
browser.find_element_by_xpath("//select[contains(@name,'length')]").click();
a19 = mymessagebox.text
if (mymessage2 in mymessagebox.text):
print("The output expected: " + mymessage2);
print("The output shown: " + a19);
else:
print("The output expected: " + mymessage2);
print("The output shown: " + a19);
time.sleep(mysecs);
browser.find_element_by_xpath("//select[contains(@name,'length')]").click();
browser.find_element_by_xpath("//select[contains(@name,'length')]").send_keys(Keys.ARROW_UP);
browser.find_element_by_xpath("//select[contains(@name,'length')]").send_keys(Keys.ENTER);
a20 = mymessagebox.text
if (mymessage3 in mymessagebox.text):
print("The output expected: " + mymessage3);
print("The output shown: " + a20);
else:
print("The output expected: " + mymessage3);
print("The output shown: " + a20);
#next
browser.find_element_by_xpath("//a[contains(.,'Next')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//a[@class='paginate_button '][contains(.,'3')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//select[contains(@name,'length')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//a[contains(.,'Next')]").click();
time.sleep(mysecs);
#prior
browser.find_element_by_xpath("//a[contains(.,'Previous')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//a[@class='paginate_button '][contains(.,'2')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//a[contains(.,'Previous')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//a[contains(.,'Previous')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//select[contains(@name,'length')]").send_keys("100");
browser.find_element_by_xpath("//select[contains(@name,'length')]").send_keys(Keys.ENTER);
myname111 = mysheet['G5'].value
myposition = mysheet['G6'].value
myoffice = mysheet['G7'].value
myage = mysheet['G8'].value
mystartdate = mysheet['G9'].value
mysalary = mysheet['G10'].value
time.sleep(mysecs);
browser.find_element_by_xpath("//input[@type='search']").send_keys(myname111);
browser.find_element_by_xpath("//input[@type='search']").send_keys(Keys.ENTER);
browser.find_element_by_xpath("//input[@type='search']").clear();
time.sleep(mysecs);
browser.find_element_by_xpath("//input[@type='search']").send_keys(myposition);
browser.find_element_by_xpath("//input[@type='search']").send_keys(Keys.ENTER);
browser.find_element_by_xpath("//input[@type='search']").clear();
time.sleep(mysecs);
browser.find_element_by_xpath("//input[@type='search']").send_keys(myoffice);
browser.find_element_by_xpath("//input[@type='search']").send_keys(Keys.ENTER);
browser.find_element_by_xpath("//input[@type='search']").clear();
time.sleep(mysecs);
browser.find_element_by_xpath("//input[@type='search']").send_keys(str(myage));
browser.find_element_by_xpath("//input[@type='search']").send_keys(Keys.ENTER);
browser.find_element_by_xpath("//input[@type='search']").clear();
time.sleep(mysecs);
browser.find_element_by_xpath("//input[@type='search']").send_keys(mystartdate);
browser.find_element_by_xpath("//input[@type='search']").send_keys(Keys.ENTER);
browser.find_element_by_xpath("//input[@type='search']").clear();
time.sleep(mysecs);
browser.find_element_by_xpath("//input[@type='search']").send_keys(str(mysalary));
browser.find_element_by_xpath("//input[@type='search']").send_keys(Keys.ENTER);
browser.find_element_by_xpath("//input[@type='search']").clear();
time.sleep(mysecs);
browser.find_element_by_xpath("//input[@type='search']").send_keys(Keys.CLEAR);
#Click on column headings to sort
browser.find_element_by_xpath("//th[contains(.,'Name')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//th[contains(.,'Position')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//th[contains(.,'Office')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//th[contains(.,'Age')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//th[contains(.,'Start date')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("//th[contains(.,'Salary')]").click();
#Open Table Data Download screen
InputForms14 = browser.find_element_by_link_text("Table");
InputForms14.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Table Data Download").click();
#Open JQuery Download Progress bars screen
InputForms15 = browser.find_element_by_link_text("Progress Bars");
InputForms15.send_keys(Keys.DOWN);
browser.find_element_by_link_text("JQuery Download Progress bars").click();
#browser.implicitly_wait(mysecs);
time.sleep(mysecs);
browser.find_element_by_xpath("//button[contains(.,'Start Download')]").click();
time.sleep(mysecs);
browser.find_element_by_xpath("(//button[contains(@type,'button')])[3]").click();
#Open Bootstrap Progress bar screen
InputForms16 = browser.find_element_by_link_text("Progress Bars");
InputForms16.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Bootstrap Progress bar").click();
time.sleep(mysecs);
browser.find_element_by_xpath("(//button[@type='button'])[2]").click();
time.sleep(mysecs * 2);
OneHundredPercnt = browser.find_element_by_xpath("//div[@class='percenttext']");
if ("100%" in OneHundredPercnt.text):
print("The output expected: " + "100%");
print("The output shown: " + OneHundredPercnt.text);
else:
print("The output expected: " + "100%");
print("The output shown: " + OneHundredPercnt.text);
#Open Drag & Drop Sliders screen
InputForms17 = browser.find_element_by_link_text("Progress Bars");
InputForms17.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Drag & Drop Sliders").click();
time.sleep(mysecs);
#grey
greybar = browser.find_element_by_xpath("//input[@onchange='range.value=value']");
numbergreybar1 = 50;
numbergreybar2 = -30;
greyslider = ActionChains(browser);
greyslider.click_and_hold(greybar).move_by_offset(numbergreybar1, 0).release().perform();
time.sleep(mysecs);
greyslider.click_and_hold(greybar).move_by_offset(numbergreybar2, 0).release().perform();
time.sleep(mysecs);
#green
greenbar = browser.find_element_by_xpath("//input[@onchange='rangeSuccess.value=value']");
numbergreenbar1 = 60;
numbergreenbar2 = -40;
greenslider = ActionChains(browser);
greenslider.click_and_hold(greenbar).move_by_offset(numbergreenbar1, 0).release().perform();
time.sleep(mysecs);
greenslider.click_and_hold(greenbar).move_by_offset(numbergreenbar2, 0).release().perform();
time.sleep(mysecs);
#orange
orangebar = browser.find_element_by_xpath("//input[@onchange='rangeWarning.value=value']");
numberorangebar1 = 80;
numberorangebar2 = -50;
orangeslider = ActionChains(browser);
orangeslider.click_and_hold(orangebar).move_by_offset(numberorangebar1, 0).release().perform();
time.sleep(mysecs);
orangeslider.click_and_hold(orangebar).move_by_offset(numberorangebar2, 0).release().perform();
time.sleep(mysecs);
#dark blue
darkbluebar = browser.find_element_by_xpath("//input[@onchange='rangePrimary.value=value']");
numberdarkbluebar1 = 70;
numberdarkbluebar2 = -80;
darkblueslider = ActionChains(browser);
darkblueslider.click_and_hold(darkbluebar).move_by_offset(numberdarkbluebar1, 0).release().perform();
browser.implicitly_wait(mysecs);
time.sleep(mysecs);
darkblueslider.click_and_hold(darkbluebar).move_by_offset(numberdarkbluebar2, 0).release().perform();
time.sleep(mysecs);
#light blue
lightbluebar = browser.find_element_by_xpath("//input[@onchange='rangeInfo.value=value']");
numberlightbluebar1 = 80;
numberlightbluebar2 = -80;
lightblueslider = ActionChains(browser);
lightblueslider.click_and_hold(lightbluebar).move_by_offset(numberlightbluebar1, 0).release().perform();
time.sleep(mysecs);
lightblueslider.click_and_hold(lightbluebar).move_by_offset(numberlightbluebar2, 0).release().perform();
time.sleep(mysecs);
#red
redbar = browser.find_element_by_xpath("//input[@onchange='rangeDanger.value=value']");
numberredbar1 = 50;
numberredbar2 = -90;
redslider = ActionChains(browser);
redslider.click_and_hold(redbar).move_by_offset(numberredbar1, 0).release().perform();
time.sleep(mysecs);
redslider.click_and_hold(redbar).move_by_offset(numberredbar2, 0).release().perform();
time.sleep(mysecs);
#Open Bootstrap Alerts screen
InputForms18 = browser.find_element_by_link_text("Alerts & Modals");
InputForms18.send_keys(Keys.DOWN);
browser.find_element_by_link_text("Bootstrap Alerts").click();
m1 = mysheet['H1'].value
m2 = mysheet['H2'].value
m3 = mysheet['H3'].value
m4 = mysheet['H4'].value
m5 = mysheet['H5'].value
m6 = mysheet['H6'].value
m7 = mysheet['H7'].value
m8 = mysheet['H8'].value
browser.find_element_by_xpath("//button[@id='autoclosable-btn-success']").click();
alert1 = browser.find_element_by_xpath("//div[contains(@class,'alert alert-success alert-autocloseable-success')]");
a21 = alert1.text
if (m1 in alert1.text):
print("The output expected: " + m1);
print("The output shown: " + a21);