2017-08-30 120 views
-1

碼 -如何解決「權限被拒絕訪問屬性」調用「」?

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) ` 

雖然試圖自動化(選擇下拉值)與硒的webdriver我就遇到了這個問題。

  • 工具版本*: Java的 - 1.8.0_91, 日食 - 釋氧(4.7.0), Mozilla Firefox瀏覽器 - 50.01, 壁虎司機v0.17.0-Win64中....請幫我理清!
+1

對不起,這不是StackOverflow的是如何工作的。請參加[旅遊],訪問[幫助]並閱讀[問]以瞭解如何有效地使用本網站。您必須發佈您的代碼和任何錯誤消息,但作爲文本而不是圖像。您的帖子中沒有足夠的信息可供任何人幫助您。 –

回答

相關問題