公共类AdminUser {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","geckodriver");
WebDriver driver=new FirefoxDriver();
driver.get("https://www.carmax.com/");
Actions builder= new Actions(driver);
WebElement d= driver.findElement(By.xpath("html/body/div[1]/header/div/nav[2]/ul/li[1]/a"));
builder.moveToElement(d).build().perform();
driver.findElement(By.linkText("Why CarMax?")).click();
}
}
I am getting o/p as:
1490543196098 geckodriver INFO在127.0.0.1:7086上收听 1490543196344 mozprofile :: profile INFO使用配置文件路径/var/folders/dg/glyvppvs1dn31sqrrgt7yhjc0000gn/T/rust_mozprofile.l2gu30iSNpnT 1490543196345 geckodriver :: marionette INFO使用args []启动浏览器/Applications/Firefox.app/Contents/MacOS/firefox-bin 1490543196348 geckodriver :: marionette INFO在localhost上连接到Marionette:59046 1490543197117 Marionette INFO在港口59046上收听 2017年3月26日下午9:16:38 org.openqa.selenium.remote.ProtocolHandshake createSession 信息:检测到的方言:W3C 2017-03-26 21:16:39.067 plugin-container [2943:127691] * CFMessagePort:bootstrap_register():失败1100(0x44c)'权限被拒绝',port = 0x9337,name =& #39; com.apple.tsm.portname' 有关错误代码,请参阅/usr/include/servers/bootstrap_defs.h。 2017-03-26 21:16:39.072 plugin-container [2943:127691] * CFMessagePort:bootstrap_register():失败1100(0x44c)'权限被拒绝',port = 0x933b,name = ' com.apple.CFPasteboardClient' 有关错误代码,请参阅/usr/include/servers/bootstrap_defs.h。 JavaScript警告:https://s-cdn-tag.medialytics.com/cp,第19行:错误:WebGL:getParameter:参数:无效的枚举值 JavaScript警告:https://s-cdn-tag.medialytics.com/cp,第19行:错误:WebGL:getParameter:参数:无效的枚举值 线程" main"中的例外情况org.openqa.selenium.ElementNotVisibleException: 构建信息:版本:' 3.3.1',修订版:' 5234b32',时间:' 2017-03-10 09:04:52 -0800' 系统信息:主持人:' Javeds-MacBook-Pro.local',ip:' fd50:1d9:9d9b:eb00:14:5aa0:4eca:be9d',os.name:& #39; Mac OS X',os.arch:' x86_64',os.version:' 10.12.3',java.version:' 1.8.0_112&# 39; 驱动程序信息:org.openqa.selenium.firefox.FirefoxDriver 功能[{moz:profile = / var / folders / dg / glyvppvs1dn31sqrrgt7yhjc0000gn / T / rust_mozprofile.l2gu30iSNpnT,rotate = false,timeouts = {implicit = 0,page load = 300000,script = 30000},pageLoadStrategy = normal,platform = ANY ,specificationLevel = 0,moz:accessibilityChecks = false,acceptInsecureCerts = false,browserVersion = 52.0.1,platformVersion = 16.4.0,moz:processID = 2941,browserName = firefox,platformName = darwin}] 会议ID:ae3c536b-197f-8941-91b4-f630e7a4dab5 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:133) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:99) 在org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:43) 在org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163) 在org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) 在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604) 在org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274) 在org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84) 在AdminUser.main(AdminUser.java:24)