RobotFramework_4.SeleniumLibrary操作(二)

  • 2019 年 10 月 3 日
  • 筆記

 

SeleniumLibrary???


??????????????????????????????
???????????????????

????

???????????????????????????????????????????AutoItLibrary???????????????????????
??????????????????????html??????????<input>???

??????????input text??????????????

????????Python?Java?????????windows????????/?
??Java?Python?????????????

alert?????

???????????????????????????????????????????“??”??????????????????????alert????
??alert???????JS????????????????????????????????????????????????????Click???

SeleniumLibrary??????Handle Alert??????

Handle Alert

?????alert??? ?????????action?timeout?action???ACCEPT?timeout???None
ACCEPT???alert????????OK???
DISMISS???alert????????Cancel???
LEAVE???alert?????alert???

timeout????alert????????????????????timeout??
?????seleniumLibrary3.0??????????Choose XXX On Next Confirmation
Alert?????????alert????????confirm?????????????prompt???????????????

??????

?????????<select>??

???????????????????click???????????????
????????????click??????click???????
???????seleniumLibrary??????????????
Select From List By Index
— index?<option>???index??????????0??
Select From List By Label
— lable?<option>????????
Select From List By Value
— value?<option>?????value???

???????????????????????????????
???????????????????????????????????????????

???RadioBox????CheckBox??

???RadioBox???????????????????????click????

???CheckBox???????????????????????????????????
???????????????????????????????????????????

????Press Key

????????????????????????????????????
Press Key
??????????????
?????????locator????key??
key???????????????????ASCII??

????????????????????xpath:/html
ue0f?python?pageDown????????unicode???????????????


??????frame/iframe??

frame?iframe?????????????????????frame??iframe????????????????????????????
??????? https://www.layui.com/admin/std/dist/views/

???????????????????????????iframe???????????????
??????????????

Select Frame

??????????????????
??????????frame????

???????????????????????????????????????????????????????????????????

Unselect Frame

?????????????
???

????????????????select frame????????????????????????????????unselect frame

???????

????????????????????????????????????????????

Select Window

???????????????????
???????locator???MAIN
??????????handle

???????????????????????????????????????????
?????????????????????????handle?????????????????

????????
– ????????????????handle?name?title?URL?????????????????????
– ???????????????????????? strategy:value (??) or strategy=value???????name?title?URL?
– ????NEW????????????????????????????
– ????MAIN????????
– ????CURRENT?????????????????handle?
– ???????????????????????handle list???list???????Get Window Handles????

????http://news.baidu.com/???????????????????????????

strategy:value????seleniumLibrary3.0??????? ??????????None?Null????????????????selft????????3.0??????
?3.0?????????name?title?URL????????