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

Is there a way to Serenity automatically gets latest driver based on current version of the browser? #2853

Closed
sudhirpogaku opened this issue Jun 22, 2022 · 9 comments

Comments

@sudhirpogaku
Copy link

It is getting very difficult everytime to manually replace the chromedriver.exe whenever chrome browser is auto updated. So, I was looking if there is any existing solution where Serenity project can get the driver based on system browser version.

@wakaleo
Copy link
Member

wakaleo commented Jun 22, 2022

Serenity integrates automatically with WebDriverManager, so you don't need to specify the chromedriver explicitly.

@sudhirpogaku
Copy link
Author

Thanks for quick response @wakaleo :)
Do we have to mention anything specific at pom level or serenity.conf level for this automatic integration ? because my project is not automatically fetching driver.
Please find below my serenity.config file:
webdriver {
driver = chrome
}
headless.mode = true
drivers {
windows {
webdriver.chrome.driver = "src/test/resources/webdriver/windows/chromedriver.exe"
}
}

So , webdriver is launched based on the path, and that path has driver which I have manually placed.
To eliminate this process of manually placing driver, what should I do?

@zzoubian
Copy link
Contributor

i would remove that drivers {windows { webdriver.chrome.driver} } block, and add webdriver.autodownload = true

Here is an example:
https://github.com/serenity-bdd/serenity-cucumber-starter/blob/master/src/test/resources/serenity.conf

@sudhirpogaku
Copy link
Author

Thanks @zzoubian for your response. I tried the solution you mentioned, but it is not for working for me. Below is the log:

_net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class org.openqa.selenium.chrome.ChromeDriver
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:144)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:132)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:102)
at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:172)
at net.serenitybdd.core.pages.PageObject.openPageAtUrl(PageObject.java:902)
at net.serenitybdd.core.pages.PageObject.openUrl(PageObject.java:851)

.
.
Caused by: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html). See below for more details.
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:158)
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:141)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:132)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:102)
at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:172)
at net.serenitybdd.core.pages.PageObject.openPageAtUrl(PageObject.java:902)
at net.serenitybdd.core.pages.PageObject.openUrl(PageObject.java:851)_

@Jagadish290392
Copy link

@sudhirpogaku have you got solution for this? I am facing the same

@sudhirpogaku
Copy link
Author

Yes Jagadesh,
Added below
webdriver.autodownload = true
chrome.switches = """--start-maximized;--test-type;--no-sandbox;--ignore-certificate-errors;--disable-popup-blocking;--disable-default-apps;--incognito;--disable-infobars;--disable-gpu;--remote-allow-origins=*"""

@Jagadish290392
Copy link

@sudhirpogaku Thank you ! It worked

@sudhirpogaku
Copy link
Author

You are welcome. Closing this issue.

@SrivaniChennupati
Copy link

@sudhirpogaku : the solution is provided working for the browser above 114 version ?

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

No branches or pull requests

5 participants