Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair drone webdriver for firefox and chrome, cleanup #158

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

WolfgangHG
Copy link
Contributor

The profiles "browser-firefox" and "browser-chrome" don't work since the update to Drone 3.0.0.Alpha7 (#91).

To run them, you have to combine the profile with a server profile:
mvn clean install -Pwildfly-remote,browser-firefox

The error for firefox is:

java.lang.RuntimeException: 
Unable to instantiate Drone via org.openqa.selenium.firefox.FirefoxDriver(FirefoxOptions): org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Unable to find a matching set of capabilities
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'MYCOMPUTER', ip: '192.168.178.101', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.8'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: , moz:debuggerAddress: true, moz:firefoxOptions: {}}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: , moz:debuggerAddress: true, moz:firefoxOptions: {}, platformName: ANY}}]
Caused by: org.openqa.selenium.SessionNotCreatedException: 
Could not start a new session. Response code 500. Message: Unable to find a matching set of capabilities
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'MYCOMPUTER', ip: '192.168.178.101', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.8'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: , moz:debuggerAddress: true, moz:firefoxOptions: {}}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: , moz:debuggerAddress: true, moz:firefoxOptions: {}, platformName: ANY}}]

And the error for chrome:

Unable to instantiate Drone via org.openqa.selenium.chrome.ChromeDriver(ChromeOptions): org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: invalid argument: entry 0 of 'firstMatch' is invalid
from invalid argument: cannot parse capability: browserVersion
from invalid argument: cannot be empty
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'MYCOMPUTER', ip: '192.168.178.101', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_381'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, browserVersion: , goog:chromeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, browserVersion: , goog:chromeOptions: {args: [], extensions: []}, platformName: ANY}}]
        at org.jboss.arquillian.drone.webdriver.factory.SecurityActions.newInstance(SecurityActions.java:166)
        at org.jboss.arquillian.drone.webdriver.factory.ChromeDriverFactory.createInstance(ChromeDriverFactory.java:81)
        at org.jboss.arquillian.drone.webdriver.factory.ChromeDriverFactory.createInstance(ChromeDriverFactory.java:42)
        at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:127)
        at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:38)
        at org.jboss.arquillian.drone.impl.DroneConfigurator$1.createInstance(DroneConfigurator.java:112)
        at org.jboss.arquillian.drone.impl.CachingCallableImpl.call(CachingCallableImpl.java:44)
        at org.jboss.arquillian.core.impl.threading.ThreadedExecutorService$ContextualCallable.call(ThreadedExecutorService.java:88)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)

Workaround/resolution: add a "browserVersion" property. Here, a wildcard works.

<extension qualifier="webdriver">
    <property name="browser">${arquillian.drone.browser}</property>
    <property name="browserVersion">*</property>
</extension>

I asked in the drone github: arquillian/arquillian-extension-drone#418 whether this is a regression or an intentional change

I also removed the property phantomjs.binary.path, as there is a drone pull request to remove support for it: arquillian/arquillian-extension-drone#403

And I commented chromeDriverBinary. The test will fail if the chromedriver is not placed in this directory, and it causes a warning when executing the tests:
WARNUNG: Support for Legacy Capabilities is deprecated; You are sending the following invalid capabilities: [chromeDriverBinary, javascriptEnabled, phantomjs.binary.path]; Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/

But chromeDriverBinary might still be necessary, as the chrome profile will not work with recent version 117. The downloaded chromedriver does not support 117:

Unable to instantiate Drone via org.openqa.selenium.chrome.ChromeDriver(ChromeOptions): org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 117.0.5938.132 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'MYCOMPUTER', ip: '192.168.178.101', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_381'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, browserVersion: *, goog:chromeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, browserVersion: *, goog:chromeOptions: {args: [], extensions: []}, platformName: ANY}}]
        at org.jboss.arquillian.drone.webdriver.factory.SecurityActions.newInstance(SecurityActions.java:166)
        at org.jboss.arquillian.drone.webdriver.factory.ChromeDriverFactory.createInstance(ChromeDriverFactory.java:81)
        at org.jboss.arquillian.drone.webdriver.factory.ChromeDriverFactory.createInstance(ChromeDriverFactory.java:42)
        at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:127)
        at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:38)
        at org.jboss.arquillian.drone.impl.DroneConfigurator$1.createInstance(DroneConfigurator.java:112)
        at org.jboss.arquillian.drone.impl.CachingCallableImpl.call(CachingCallableImpl.java:44)
        at org.jboss.arquillian.core.impl.threading.ThreadedExecutorService$ContextualCallable.call(ThreadedExecutorService.java:88)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)

It seems this is caused by the fact that the download for chromedriver has changed since 115: https://chromedriver.chromium.org/downloads/version-selection
This probably requires an update to latest Selenium, which has be done through Drone. There is also a Drone pull request for this: arquillian/arquillian-extension-drone#401

When downloading a matching chromedriver and setting the property "chromeDriver"...
<property name="chromeDriverBinary">c:\path\to\chromedriver.exe</property>
...it still fails:

Sep 29, 2023 9:18:03 PM org.openqa.selenium.remote.http.WebSocket$Listener onError
WARNUNG: Invalid Status code=403 text=Forbidden
java.io.IOException: Invalid Status code=403 text=Forbidden
        at org.asynchttpclient.netty.handler.WebSocketHandler.abort(WebSocketHandler.java:92)
        at org.asynchttpclient.netty.handler.WebSocketHandler.handleRead(WebSocketHandler.java:118)
        at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:78)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:314)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:435)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:750)

And this is the point where I give up for now ;-).
Those pages https://stackoverflow.com/questions/75730109/how-to-overcome-invalid-status-code-403-text-forbidden-this-error-in-selenium and SeleniumHQ/selenium#11750 suggest to use a chrome argument --remote-allow-origins=*, but I could not make it work with Drone. This did not work:
<property name="chromeArguments">--remote-allow-origins=*</property>

If Drone supports latest Selenium, it would be worth another look.

@WolfgangHG
Copy link
Contributor Author

Don't merge this pull request, but keep it on hold.
When building drone including pull request 401, the "browserVersion" attribut is not necessary.
Also, the chrome profile works again without specifying "chromeArguments".

Only open problem: download of chromdriver fails.

When the next drone release is done, I will come back to this pull request. At least the cleanup will still be relevant.

@WolfgangHG WolfgangHG marked this pull request as draft October 8, 2023 09:15
@chengfang chengfang added the hold label Oct 9, 2023
WolfgangHG and others added 12 commits May 12, 2024 10:25
…an#153)

Bumps [org.apache.httpcomponents.core5:httpcore5](https://github.com/apache/httpcomponents-core) from 5.2.2 to 5.2.3.
- [Changelog](https://github.com/apache/httpcomponents-core/blob/master/RELEASE_NOTES.txt)
- [Commits](apache/httpcomponents-core@rel/v5.2.2...rel/v5.2.3)

---
updated-dependencies:
- dependency-name: org.apache.httpcomponents.core5:httpcore5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…quillian#155)

Bumps com.mycila:license-maven-plugin from 4.2 to 4.3.

---
updated-dependencies:
- dependency-name: com.mycila:license-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…llian#159)

Bumps [xyz.rogfam:littleproxy](https://github.com/LittleProxy/LittleProxy) from 2.0.20 to 2.0.22.
- [Release notes](https://github.com/LittleProxy/LittleProxy/releases)
- [Changelog](https://github.com/LittleProxy/LittleProxy/blob/main/RELEASE_NOTES.md)
- [Commits](LittleProxy/LittleProxy@v2.0.20...v2.0.22)

---
updated-dependencies:
- dependency-name: xyz.rogfam:littleproxy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [org.apache.logging.log4j:log4j-bom](https://github.com/apache/logging-log4j2) from 2.20.0 to 2.21.0.
- [Release notes](https://github.com/apache/logging-log4j2/releases)
- [Commits](apache/logging-log4j2@rel/2.20.0...rel/2.21.0)

---
updated-dependencies:
- dependency-name: org.apache.logging.log4j:log4j-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps `version.jacoco` from 0.8.10 to 0.8.11.

Updates `org.jacoco:org.jacoco.core` from 0.8.10 to 0.8.11
- [Release notes](https://github.com/jacoco/jacoco/releases)
- [Commits](jacoco/jacoco@v0.8.10...v0.8.11)

Updates `org.jacoco:jacoco-maven-plugin` from 0.8.10 to 0.8.11
- [Release notes](https://github.com/jacoco/jacoco/releases)
- [Commits](jacoco/jacoco@v0.8.10...v0.8.11)

---
updated-dependencies:
- dependency-name: org.jacoco:org.jacoco.core
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.jacoco:jacoco-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [org.apache.logging.log4j:log4j-bom](https://github.com/apache/logging-log4j2) from 2.21.0 to 2.22.0.
- [Release notes](https://github.com/apache/logging-log4j2/releases)
- [Commits](apache/logging-log4j2@rel/2.21.0...rel/2.22.0)

---
updated-dependencies:
- dependency-name: org.apache.logging.log4j:log4j-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@WolfgangHG
Copy link
Contributor Author

Drone 3.0.0-alpha.8 is out and should fix the problems. But it is build with Java 11. So we cannot wait for it if we want to do a final Java 1.8 release before switching to Java 11/JakartaEE10.

Sorry for the commit chaos - I tried to sync my fork with recent changes, and probably broke something. If this breaks merging of the pull request, I can do a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants