SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.7k stars 8.19k forks source link

[🚀 Feature]: Remove Opera Classes #10379

Closed titusfortner closed 2 years ago

titusfortner commented 2 years ago

Feature and motivation

opera driver has not been updated to support w3c, so we've agreed to remove those classes.

Usage example

Ruby deleted the classes for Selenium 3 release.

Users can use Chromedriver for opera with ChromeOptions class and setBinary with the path to the Opera Browser.

diemol commented 2 years ago

Do you remember if we want to deprecate first and the remove?

titusfortner commented 2 years ago

https://www.selenium.dev/meetings/2022/tlc-01-19/#delete-opera-classes-from-the-bindings-given-that-operadriver-does-not-support-w3c

Deprecate in Java, remove elsewhere

symonk commented 2 years ago

@titusfortner happy enough if i rip out the Opera classes on the python side without deprecation?

ibodog commented 2 years ago

I saw the deprecation note in the java docs for selenium. Not sure how to tell Selenium Grid to use the Chrome workaround. My grid rejects the session request if I use ChromeOptions and then change 'browserName' to 'Opera'. Without that change the grid just runs the Chrome browser (when you think you've asked for Opera). BTW, this is using the dockerized grid with node-docker. Opera, Chrome, Firefox, Edge are all enabled on the grid and Opera works OK with the deprecated OperaOptions (outside of the w3c issues...).

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Caused by: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.1.3', revision: '7b1ebf28ef'
System info: host: 'test', ip: 'fe80:0:0:0:1843:95ae:fcd0:90b4%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.6.5', java.version: '17.0.2'
Driver info: driver.version: RemoteWebDriver
Caused by: java.util.concurrent.TimeoutException

Grid shows this pending session: "acceptInsecureCerts":true,"acceptSslCerts":true,"browserName":"Opera","build":"opera","goog:chromeOptions":{"args":[],"excludeSwitches":["enable-automation"],"extensions":[]},"name":"alfresco_TestAddFolder.createFolder","pageLoadStrategy":"eager","screenResolution":"1272x1024","se.screenResolution":"1272x1024","se:recordVideo":true,"se:timeZone":"America/Chicago","tz":"America/Chicago"}

titusfortner commented 2 years ago

@ibodog To use opera:

  1. Do everything the same as if you are using chrome (class names, browser name, etc)
  2. Determine the path to Opera browser binary on node machine
  3. Use the setBinary() method and pass in that path as a string.

If not all nodes will have have both Opera & Chrome installed, then you'll need to set a custom capability in the node and also match that in capabilities https://www.selenium.dev/documentation/grid/configuration/cli_options/#setting-custom-capabilities-for-matching-specific-nodes

ibodog commented 2 years ago

I think there is some additional step needed when running the dockerized grid w/node-docker since that node spins up yet another container. Here's what I get when I do everything like Chrome except add the setBinary. In the selenium/standalone-opera docker image the opera binary is located at "/usr/bin/opera". MutableCapabilities caps = new ChromeOptions(); ((ChromeOptions) caps).setBinary("/usr/bin/opera");

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Could not start a new session. Could not start a new session. Unable to create session: Could not start a new session. Response code 500. Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: no chrome binary at /usr/bin/opera

titusfortner commented 2 years ago

If you have the opera browser at that location, you won't get that message.

@diemol is there something that I'm missing wrt the docker containers?

diemol commented 2 years ago

@ibodog the Docker image for Opera is not available for Selenium Grid 4. The one you reference was the last one created for Selenium Grid 3. So I would not expect it to work with the Dynamic Grid (node-docker). Also, to do what @titusfortner is pointing out, you would need to have ChromeDriver available and clearly the selenium/standalone-opera does not have it.

Probably you need to build your own Docker image with Opera using Selenium 4.

ibodog commented 2 years ago

Have been using that selenium/standalone-opera image w/node-docker Selenium Grid 4 for a couple of months and only seeing the W3C non-compliance issues w/the Opera driver (most tests ran fine). Didn't notice that the image wasn't being actively maintained.

titusfortner commented 2 years ago

Java looks at the code getting sent and makes a guess about what you probably want to do and then tries to compensate based on the end node protocol. It mostly works so you won't notice the difference, but it has a number of issues and we're looking at removing the functionality going forward as that is going to be much easier than trying to fix it.

titusfortner commented 2 years ago

Python - 6b01d3518a48899f9904f96fc506e689e1047f68

titusfortner commented 2 years ago

.NET 6dcef3a7f8a0830e644fb366d0a556f9722fa384

titusfortner commented 2 years ago

Java b3f9d377d04dcefb5bfbc6fbdaffccf946bfedda

titusfortner commented 2 years ago

Java & Python are only deprecated, so everything is ready for 4.2 Opera will be removed in Java & Python for 4.3

symonk commented 2 years ago

This is milestoned 4.3 - @titusfortner I'll let you merge this: https://github.com/SeleniumHQ/selenium/pull/10630 i we are happy to bring it in, I think it is good for merging if you are happy, thanks! (test failures are unrelated)

symonk commented 2 years ago

Dropping C-py as merged to trunk

titusfortner commented 2 years ago

Let's remove it in Java in 4.5 not 4.4

github-actions[bot] commented 2 years ago

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

diemol commented 2 years ago

Java PR was merged a moment ago, closing.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.