android emulator在运行selenium脚本时挂起
我正在使用selenium测试android web应用程序。我的测试最初运行良好,但在特定点挂起。它选择网页上的第一个文本字段,并在放大模式下写入值,但此时挂起,不选择第二个文本字段。我哪里做错了 我的代码如下: public void testRegister()引发异常 {android emulator在运行selenium脚本时挂起,android,selenium-webdriver,Android,Selenium Webdriver,我正在使用selenium测试android web应用程序。我的测试最初运行良好,但在特定点挂起。它选择网页上的第一个文本字段,并在放大模式下写入值,但此时挂起,不选择第二个文本字段。我哪里做错了 我的代码如下: public void testRegister()引发异常 { driver.get(“file:///android_asset/www/aboutus.html"); findelelement(By.xpath(“html/body/div/div/ul/li[2]”); 列
driver.get(“file:///android_asset/www/aboutus.html");
findelelement(By.xpath(“html/body/div/div/ul/li[2]”);
列表w1=driver.findElements(按.tagName(“输入”));
System.out.println(w1.size());
对于(int i=0;i
id可以是“”,它将返回空值
元素列表中可以隐藏具有相同id的元素
出于更多原因,请发布堆栈跟踪。
向塔拉斯问好
driver.get("file:///android_asset/www/aboutus.html");
driver.findElement(By.xpath("html/body/div/div/ul/li[2]")).click();
List<WebElement> w1=driver.findElements(By.tagName("input"));
System.out.println(w1.size());
for(int i=0;i<w1.size();i++)
{
System.out.println("************");
System.out.println(i + w1.get(i).getAttribute("id") +"*****" + w1.get(i).getAttribute("name"));
}
for(WebElement option:w1)
{
String str=option.getAttribute("id");
if(str.equals("name"))
{
option.click();
option.sendKeys("Vaishali");
}
else if(str.equals("dateofbirth"))
{
option.click();
option.sendKeys("28-09-1991");
}
else if(str.equals("club"))
{
option.click();
option.sendKeys("Manchester United");
}
else if(str.equals("username"))
{
option.click();
option.sendKeys("vishchan");
}
else if(str.equals("password"))
{
option.click();
option.sendKeys("vishchan");
}
else if(str.equals("sendbutton"))
{
option.click();
}
}