serenity-bdd / serenity-cucumber-starter

A skeleton project for Serenity BDD and Cucumber JVM
Apache License 2.0
182 stars 292 forks source link

Remote driver is not working for the Safari #101

Open rohitsh1691 opened 1 year ago

rohitsh1691 commented 1 year ago

Hi,

The remote driver is not working for the safari browser as working fine with the chrome browser. During a session with the grid, hub shows empty capabilities like {} and chrome shows all capabilities.

Selenium grid 4.7.2 is started locally in standalone mode. Serenity-BDD version 3.5.1 Selenium Grid version - 4.7.2 Safari version - 16.2

The selenium starter sample code is also working for the safari with Selenium grid 4.7.2 and shows all capabilities of the safari.

Serenity properties file: webdriver.driver=remote webdriver.remote.driver=safari/chrome webdriver.remote.os=MAC webdriver.remote.url=http://localhost:4444/wd/hub

There is a related open issue for selenium grid - https://github.com/SeleniumHQ/selenium/issues/11390

wakaleo commented 1 year ago

This looks like a Selenium issue, not a Serenity issue.

rohitsh1691 commented 1 year ago

Grid is working with the selenium sample code for safari on local.

wakaleo commented 1 year ago

In that case your best option would be to compare the code that is working for Safari on your local grid, and compare with the Serenity code, and propose a PR with the appropriate fixes.

remyanekkuth commented 1 year ago

@wakaleo with the serenity versions 3.0.0 and above, in order to run the test for safari node, we have to explicitly add the capabilities in serenity.conf. otherwise test is going to queue and eventually timed out.

https://github.com/SeleniumHQ/selenium/issues/11390 as mentioned in this, tried with below config and test worked.

serenity {

take.screenshots = FOR_FAILURES

}

webdriver {

driver = remote

remote {

  url=http://localhost:4444/

  driver=safari

}

capabilities {

browserName = "safari"

}

}

why it is not working with the run configuration like -Denvironment=envt -Dwebdriver.driver=remote -Dwebdriver.remote.driver=safari

Attaching log from node . 02062023-execution_new.txt

remyanekkuth commented 1 year ago

Tried with 3.6.7 as well

wakaleo commented 1 year ago

Try to get it working with plain Selenium, then look at the source code of the SafariDriverProvider class, to see if there is anything obvious. I never use Safari myself so this probably isn't something that will get much attention in the immediate future unless it is part of a support request or a community contribution.

remyanekkuth commented 1 year ago

@wakaleo sure.will test with selenium version. would you please provide the path to safaridriver provider class as well.

wakaleo commented 1 year ago

https://github.com/serenity-bdd/serenity-core/blob/e0adb11bbac35706329adc6a37ed08ddb07dc567/serenity-core/src/main/java/net/serenitybdd/core/webdriver/driverproviders/SafariDriverProvider.java

remyanekkuth commented 1 year ago

@wakaleo I was successfully able to run with selenium 4 for safari browser. selenium-java 4.6.0 version. Looks like now we have to see why Serenity is having trouble reaching Safari node.