I am getting the following error after running the code:
Exception in thread "main" org.openqa.selenium.InvalidArgumentException: invalid argument
(Session info: chrome=103.0.5060.114)
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'SADAF-RAUF', ip: '192.168.1.55', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.15'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [99bdbf5c25fd5790a4c9901c3f7f1dde, clickElement {id=1d9cbee0-b4cb-4993-b271-3a3e36c42165}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 103.0.5060.114, chrome: {chromedriverVersion: 103.0.5060.53 (a1711811edd7..., userDataDir: C:\Users\Sadaf\AppData\Loca...}, goog:chromeOptions: {debuggerAddress: localhost:64336}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: WINDOWS, proxy: Proxy(), se:cdp: ws://localhost:64336/devtoo..., se:cdpVersion: 103.0.5060.114, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Element: [[ChromeDriver: chrome on WINDOWS (99bdbf5c25fd5790a4c9901c3f7f1dde)] -> id: uploadPicture]
Session ID: 99bdbf5c25fd5790a4c9901c3f7f1dde
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:257)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:78)
at com.autoit.FileUpload.upload(FileUpload.java:25)
at com.autoit.FileUpload.main(FileUpload.java:32)code image
//use Sendkeys
driver.findElement(By.id("uploadPicture")).sendKeys("L:\Software\wrar511b1.exe");
Related
how to make "network.websocket.allowInsecureFromHTTPS" true?
I have firefox installed on the openstack cloud VM and when i run the test i have this
Error during script execution on page https://...fr/ SecurityError: The operation is insecure. Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'tanaguru', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-52-generic', java.version: '11.0.17' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 102.4.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:buildID: 20221010114559, moz:geckodriverVersion: 0.32.0, moz:headless: true, moz:processID: 516150, moz:profile: /tmp/rust_mozprofileiUzVeb, moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 5.15.0-52-generic, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify} Session ID: b97f16bc-d5ee-4cb2-8fc7-1f54efcf585c
I install the certificat but I still have the same problem
I'm using Fitnesse to create tests. When I run them in de webbased tool they succeed. When run via Microsoft Visual Studio Team Foundation Server I get the following error, although sometimes it seems to run normal at the same point but in a different testcase.
org.openqa.selenium.WebDriverException: Unable to execute request for an existing session: Unable to find session with ID: <session-id>
Build info: version: '4.1.3', revision: '7b1ebf28ef'
System info: host: 'G-WPTAPP-01', ip: '<ip>', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '12.0.1'
Driver info: driver.version: unknown
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'G-WPTAPP-01', ip: '<ip>', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '12.0.1'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [<session-id>, findElements {using=css selector, value=#mask}]
Capabilities {acceptInsecureCerts: false, browserName: msedge, browserVersion: 102.0.1245.44, javascriptEnabled: true, ms:edgeOptions: {debuggerAddress: localhost:64446}, msedge: {msedgedriverVersion: 102.0.1245.44 (72efbf98e0b4..., userDataDir: D:\Users\svc_g-wptapp-01\Ap...}, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:cdp: ws://<ip>:4444/sessi..., se:cdpVersion: 102.0.1245.44, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: ignore, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: <session-id>
I have already tried updating the edgedriver and extending the grid session-timeout but it doesn't seem to help.
I have used Axe core in selenium framework when it tries to execute:
[JSONObject responseJSON = new AXE.Builder(driver, scriptUrl).analyze();
Below exception is thrown:
16:39:26:09-12-2019>>org.openqa.selenium.ScriptTimeoutException: script timeout
(Session info: chrome=78.0.3904.108)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'L3DV3N62', ip: '10.93.47.117', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 78.0.3904.108, chrome: {chromedriverVersion: 78.0.3904.105 (60e2d8774a81..., userDataDir: C:\Users\SSUPAR~1.TEM\AppDa...}, goog:chromeOptions: {debuggerAddress: localhost:61391}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: c3e0abe6c1b2ca3a34b765b70cc594df
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:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.executeAsyncScript(RemoteWebDriver.java:506)
at com.deque.axe.AXE$Builder.execute(AXE.java:372)
at com.deque.axe.AXE$Builder.analyze(AXE.java:335)
at Driver.Reuse.analyzeViolations(Reuse.java:6146)
at AppLib.AnalyzeViolation.ExecuteComponent(AnalyzeViolation.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at AppLib.Reflection.execute(Reflection.java:26)
at Driver.Demo1.testDemo1(Demo1.java:1130)
at Driver.Demo1.main(Demo1.java:748)
Below timeout setting works for me:
JSONObject responseJSON = new AXE.Builder(driver, scriptURL)
.options("{ runOnly: { type: 'tag', values: ['wcag2a','wcag2aa'] } }")
.setTimeout(60000).analyze();
I tried to click a button of select files then submit button in the popup but it neither recognizes the popup nor the button in it.
For selecting the modal-content
driver.switchTo().frame("modal-content");
message:
Exception in thread "main" org.openqa.selenium.NoSuchFrameException: No frame element found by name or id modal-content
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'RAUNAK-MA', ip: '192.168.2.200', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.frame(RemoteWebDriver.java:885)
at newpackage1.newTest.main(newTest.java:41)
post removing the switch to and directly selecting the element
WebElement LinkCheckerbutton1 = driver.findElement(By.id("linkCheckerFileUpload"));
LinkCheckerbutton1.click();
Results:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"linkCheckerFileUpload"}
(Session info: chrome=73.0.3683.103)
(Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'RAUNAK-MA', ip: '192.168.2.200', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.46.628402 (536cd7adbad73a..., userDataDir: C:\Users\RAUNAK~1.MAS\AppDa...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:65266}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), rotatable: false, setWindowRect: true, strictFileInteractability: false, takesHeapSnapshot: true, takesScreenshot: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unexpectedAlertBehaviour: ignore, unhandledPromptBehavior: ignore, version: 73.0.3683.103, webStorageEnabled: true}
Session ID: 889a04bb870854aef890e9dcb55c7508
*** Element info: {Using=id, value=linkCheckerFileUpload}
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.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:372)
at org.openqa.selenium.By$ById.findElement(By.java:188)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
at newpackage1.newTest.main(newTest.java:43)
This error message...
Exception in thread "main" org.openqa.selenium.NoSuchFrameException: No frame element found by name or id modal-content
...implies that there is no frame element by the id or name modal-content.
However it gives us a hint the desired element is within a Modal Dialog Box.
So to locate the element you have to induce WebDriverWait for the elementToBeClickable() and you can use either of the following Locator Strategies:
cssSelector:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("#linkCheckerFileUpload"))).click();
xpath:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[id='linkCheckerFileUpload']"))).click();
Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out
waiting for page to load.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-
14T08:25:48'
System info: host: 'INGGNED89DP882', ip: '10.197.131.45', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities {acceptInsecureCerts: false, browserName: internet explorer,
browserVersion: 11, javascriptEnabled: true, pageLoadStrategy: normal,
platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:ieOptions:
{browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover:
true, ie.browserCommandLineSwitches: , ie.ensureCleanSession: true,
ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false,
ignoreProtectedModeSettings: true, ignoreZoomSetting: false, initialBrowserUrl:
http://localhost:46027/, nativeEvents: true, requireWindowFocus: false},
setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
Session ID: 908d30d6-dc3f-4ac8-a1ca-1ddfc060b716
Getting above exception in Internet Explorer Windows 10 , java.version: '1.8.0_60'
try to use the explicit wait based on the condition
WebDriverWait wait = new WebDriverwait(driver,30);
wait.Until(ExpectedCondtions.VisibilityofemementlocatedBy(yourxpath));