selenium 页面经常改变元素_selenium 总结篇,常见方法和页面元素的操作

今天,总结一下selenium怎么操作web页面常见的元素。

主要有:

上传

alter dialog

prompt dialog

confirm dialog

select list

radio box

input box

checkBox

测试页面如下:

1

2

3

selenium处理基本页面元素

4

5 table{font-size:26;text-align:center;width:80%;border-collapse:collapse;margin:auto}

6 table th{background:#aff}

7 .display{color:red}

8 .widgetStyle{text-align:left;padding-left:100px}

9

10

11 functionclickbutton(flag)12 {13 if(flag== 1) alert("测试alert对话框");14 if(flag== 2)15 {16 varname=prompt("测试prompt对话框","");17 if(name!=null &&name!="")18 {19 //document.write(name);

20 alert(name);21 }22 }23 if(flag== 3)24 {25 varr=confirm('测试confirm对话框','测试confirm对话框?',"测试结果:")26 if(r==true)27 {28 //document.write("You pressed OK!")

29 alert("You pressed OK!");30 }31 else

32 {33 //document.write("You pressed Cancel!")

34

35 alert("You pressed Cancel!");36 }37 }38 if(flag== 4)39

40 alert(document.getElementById("edit").value);41

42

43 }44

45

46

47

48 functiongetOptions()49 {50 varx=document.getElementById("Selector");51 vary=x.options[x.selectedIndex].text52 //document.write(y);

53 alert(y);54 }55

56

57

58

59

60

61

62

63

64 seleniun处理基本元素

65

66


67

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值