如何解决"访问财产"invoke""的权限被拒绝?



代码 -

Select Gender = new Select(driver.findElement(By.xpath("//select[@id='gender']")));
Gender.selectByValue("Male");

错误 -

`Exception in thread "main" org.openqa.selenium.WebDriverException: **Permission denied to access property "invoke"** 
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' 
System info: host: 'COMP2-PC', ip: '192.168.1.9', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91' 
Driver info: org.openqa.selenium.firefox.FirefoxDriver 
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, appBuildId=20161123182536, version=50.0.1, platform=XP, proxy=Proxy(), command_id=1.0, specificationLevel=0.0, acceptSslCerts=false, processId=2380.0, browserVersion=50.0.1, platformVersion=6.1, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=firefox, takesScreenshot=true, takesElementScreenshot=true, javascriptEnabled=true, platformName=windows_nt}] Session ID: c1e4da76-9f21-45aa-a1b8-f21a9e8dd088     
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)    
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)    
at java.lang.reflect.Constructor.newInstance(Unknown Source)    
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException
(W3CHttpResponseCodec.java:150)     
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode
(W3CHttpResponseCodec.java:115)     
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode
(W3CHttpResponseCodec.java:45)  
at org.openqa.selenium.remote.HttpCommandExecutor.execute
(HttpCommandExecutor.java:164)  
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute
(DriverCommandExecutor.java:82)     
at org.openqa.selenium.remote.RemoteWebDriver.execute
(RemoteWebDriver.java:637)  
at org.openqa.selenium.remote.RemoteWebElement.execute
(RemoteWebElement.java:272)     
at org.openqa.selenium.remote.RemoteWebElement.getAttribute
(RemoteWebElement.java:124)     
at org.openqa.selenium.support.ui.Select.<init>(Select.java:52)     
at AppInformationTest.main(AppInformationTest.java:70) `

尝试使用Selenium webdriver自动化(选择下拉值)时,我遇到了这个问题。

  • 工具版本是*: Java -1.8.0_91, Eclipse-氧气释放(4.7.0), Mozilla Firefox-50.01, 壁虎驱动程序-V0.17.0-WIN64 ....请帮助我解决!

它是浏览器Specfic问题,请使用Chrome尝试。请按照此链接查看更多

您的问题的参考链接

最新更新