2017-04-15 263 views
-2

我正在给出正确的XPath。只有一个匹配节点。但它仍然给我的问题。 我用TestNGno such element:无法找到元素:{“method”:“xpath”,“selector”:“// input [@ id ='IDToken1']”}

我的代码是:

driver.navigate().to("http://uk.support.tomtom.com/app/questions/extended_warranty"); 
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS); 
driver.findElement(By.xpath("//input[@id='IDToken1']")).sendKeys("myemailaddress"); 

HTML是:

<input id="IDToken1" class="form-control" name="IDToken1" value="" data-validation="text" data-required="true" onkeydown="enableSubmit();" onchange="enableSubmit();" onkeyup="enableSubmit();" onmouseup="enableSubmit();" placeholder="[email protected]" type="text"/> 
+0

检查是否位于一个''