2

我正在研究 gmail 登录页面上的示例 gmail 登录应用程序。

当我单击创建帐户链接时,会显示一个新页面,在此页面中我想访问月份(在生日部分)。

我尝试了 div 元素它给出了一个错误你能帮我吗?

4

2 回答 2

1

请试试这个,它会正常工作的

require 'watir-webdriver'

ie=Watir::Browser.new :firefox

ie.goto "https://accounts.google.com/SignUp?continue=https%3A%2F%2Fwww.google.co.in%2Fsearch%3Fq%3Dgoog%26oq%3Dgoog%26aqs%3Dchrome..69i57j69i60l5.807j0%26sourceid%3Dchrome%26espv%3D210%26es_sm%3D93%26ie%3DUTF-8&hl=en"

ie.div(:text,"Month").click

#here you can put your month you want to select
ie.div(:text,"March").click


#select date here
ie.text_field(:id, "BirthDay").set "11"

#select year here
ie.text_field(:id, "BirthYear").set "1992"
于 2013-10-05T18:36:45.077 回答
1

我想你很困惑在哪里点击选择月份。实际上当你根据id点击div时,javascript运行。

ie.div(:text,"Month").click
//here you can place any month with correct name
ie.div(:text,"March").click
于 2013-10-06T03:49:11.027 回答