【发布时间】:2018-06-06 06:48:50
【问题描述】:
public class Bwinbe {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "mypath");
WebDriver driver = new ChromeDriver();
driver.get("http://test.www.bwin.be/");
WebDriverWait wait = new WebDriverWait(driver,20);
driver.findElement(By.id("login-overlay-button")).click();
driver.findElement(By.id("username")).sendKeys("passport3");
driver.findElement(By.id("password")).sendKeys("qwe123");
driver.findElement(By.id("submit")).click();
}
}
运行时出现异常。它无法通过名称或 id 找到元素
【问题讨论】:
-
线程“主”org.openqa.selenium.NoSuchElementException 中的异常:没有这样的元素:无法找到元素:{“method”:“id”,“selector”:“username”}(会话信息:chrome=66.0.3359.181)(驱动程序信息:chromedriver=2.39.562718(9a2698cba08cf5a471a29d30c8b3e12becabb0e9),平台=Windows NT 10.0.14393 x86_64)(警告:服务器未提供任何堆栈跟踪信息)命令持续时间或超时:0毫秒
-
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.39.562718 (9a2698cba08cf5..., userDataDir: C:\Users \ivy4326\AppData\Lo...},cssSelectorsEnabled:true,databaseEnabled:false,handlesAlerts:true,hasTouchScreen:false,javascriptEnabled:true,locationContextEnabled:true,mobileEmulationEnabled:false,nativeEvents:true,networkConnectionEnabled:false,pageLoadStrategy:正常,平台:XP,平台名称:XP,
-
使用
edit选项更新您的问题,而不是发布 cmets -
不要堵塞评论部分,让您的堆栈跟踪受到质疑?请提供一些 Html。
-
@Chandru 请使用正确的详细信息正确更新您的问题,哪个元素出现错误。
标签: java google-chrome selenium-webdriver