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

Running Same Cucumber Scenario on multiple browsers parallely with Serenity BDD(Java) #2271

Closed
nitin1989 opened this issue Oct 13, 2020 · 11 comments

Comments

@nitin1989
Copy link

HI ,
I have a case where I need to execute same scenario(s) in cucumber Feature file on multiple browsers(chrome,firefox,ie)
I don't want to use Selenium grid setup.
Is there any way this can be achievable in serenity with Java?

@wakaleo
Copy link
Member

wakaleo commented Oct 26, 2020

This isn't supported currently.

@nitin1989
Copy link
Author

OK.
Will there be any support for cross browser parallel testing in any future release?

@wakaleo
Copy link
Member

wakaleo commented Oct 26, 2020

Perhaps. Is it important to your projects?

@nitin1989
Copy link
Author

Yes.

@wakaleo
Copy link
Member

wakaleo commented Oct 26, 2020

Can your company sponsor it?

@nitin1989
Copy link
Author

Not sure. Need to discuss.

@narasimhaduppula
Copy link

Appreciate your help.
I am new to this, I have been trying to work with IE and Firefox browsers using Serenity Cucumber. code is able to launch both the browsers with give URL. But after that it is not at all interacting with Browser. Getting NoSuchElement error. Same code working fine with Chrome Browser.

Is there any other setting i have to use to work with IE and Firefox browser in serenity.Properties file, Thank you
Firefox Log

@narasimhaduppula
Copy link

HI ,
I have a case where I need to execute same scenario(s) in cucumber Feature file on multiple browsers(chrome,firefox,ie)
I don't want to use Selenium grid setup.
Is there any way this can be achievable in serenity with Java?

hi Nithin,

could you share the settings required to work with Firefox and IE browsers, thank you.

@narasimhaduppula
Copy link

HI ,
I have a case where I need to execute same scenario(s) in cucumber Feature file on multiple browsers(chrome,firefox,ie)
I don't want to use Selenium grid setup.
Is there any way this can be achievable in serenity with Java?

hi Nithin,

could you share the settings required to work with Firefox and IE browsers, thank you.

Serenity is opening the Browser ( firefox and IE ) and navigating to the Base URl as provided. but then it is throwing no such element exception to perform any action on application.

Serenity version 2.2.9, Firefox version 78.4, gecko driver 0.27
IE version 11.1139.18362 , IE Driver 3.9.0 ( https://selenium-release.storage.googleapis.com/index.html?path=3.9/ )

19:57:38.586 [main] WARN i.c.junit.CucumberSerenityRunner - By default Cucumber is running in --non-strict mode.
This default will change to --strict and --non-strict will be removed.
You can use --strict or @CucumberOptions(strict = true) to suppress this warning
19:57:39.299 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - LOADING LOCAL PROPERTIES FROM C:\Serenity\SerenityBDD\serenity.properties
19:57:39.446 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - LOADING LOCAL PROPERTIES FROM C:\Serenity\SerenityBDD\serenity.properties
19:57:39.446 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - LOADING LOCAL PROPERTIES FROM C:\Serenity\SerenityBDD\serenity.properties
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.summary.report.title=Project Summary Report
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.reports.show.step.details=true
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.reports=single-page-html
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - report.customfields.ApplicationVersion=1.0.0
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.report.show.manual.tests=false
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.project.name=Presentment Project
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - report.customfields.user=XXXXXXX
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - chrome_experimental_options.useAutomationExtension=false
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.take.screenshots=FOR_FAILURES
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.console.colors=true
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - chrome.switches=--args -disable-extensions
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.test.root=stories
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.store.html.source=true
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - webdriver.driver=firefox
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.logging=QUIET
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - webdriver.wait.for.timeout=90000
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.browser.maximized=true
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - serenity.exclude.unrelated.requirements.of.type=capabilities
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - drivers.mac.webdriver.chrome.driver=src/webdriver/windows/chromedriver.exe
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - drivers.windows.webdriver.gecko.driver=src/webdriver/windows/geckodriver.exe
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - drivers.linux.webdriver.chrome.driver=src/webdriver/windows/chromedriver.exe
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - environments.default.webdriver.base.url=https://google.com
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - drivers.windows.webdriver.ie.driver=src/webdriver/windows/IEDriverServer.exe
19:57:39.462 [main] DEBUG n.t.c.u.PropertiesFileLocalPreferences - drivers.windows.webdriver.chrome.driver=src/webdriver/windows/chromedriver.exe

@test
Scenario: 01 - Test Scenario # src/test/resources/features/demo.feature:3
Feature from file:///C:/Serenity/SerenityBDD/src/test/resources/features/demo.feature
19:57:40.733 [main] DEBUG n.t.c.r.m.cucumber.CucumberParser - Added feature Sample Test case

Oct 29, 2020 7:57:41 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()
Oct 29, 2020 7:57:41 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()
19:57:42.560 [main] INFO n.s.c.w.d.ProvideNewDriver - Instantiating driver
19:57:42.560 [main] INFO n.s.c.w.d.ProvideNewDriver - Driver capabilities: Capabilities {acceptInsecureCerts: true, browserName: firefox, firefox_profile: org.openqa.selenium.firefox..., headless: false, loggingPrefs: org.openqa.selenium.logging..., marionette: true, moz:firefoxOptions: {}, platform: ANY, version: }
1603981663399 geckodriver INFO Listening on 127.0.0.1:38748
1603981663815 mozrunner::runner INFO Running command: "C:\Program Files\Mozilla Firefox\firefox.exe" "--marionette" "-foreground" "-no-remote" "-profile" "C:\Users\duppulan\AppData\Local\Temp\rust_mozprofileGpYktw"
console.error: Policies.jsm:
Invalid ExtensionSettings
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1603981667940 Marionette INFO Listening on port 2540
1603981668072 Marionette WARN TLS certificate errors will be ignored for this session
Oct 29, 2020 7:57:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Given Launching Google Application # stepdefinitions.google_Application()
When Provide the Control number as "8695024318027023" and submit # stepdefinitions.googleStepDef.provide_the_Control_number_as_and_submit(java.lang.String)
org.openqa.selenium.NoSuchElementException: Timed out after 2 seconds. Element not found
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:17:03'
System info: host: 'BGLRT4700245', ip: '10.105.66.37', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: unknown
at net.thucydides.core.annotations.locators.SmartAjaxElementLocator.ajaxFindElement(SmartAjaxElementLocator.java:166)
at net.thucydides.core.annotations.locators.SmartAjaxElementLocator.findElement(SmartAjaxElementLocator.java:118)
at net.serenitybdd.core.pages.WebElementResolverByElementLocator.resolveForDriver(WebElementResolverByElementLocator.java:30)
at net.serenitybdd.core.pages.WebElementFacadeImpl.getResolvedELement(WebElementFacadeImpl.java:234)
at net.serenitybdd.core.pages.WebElementFacadeImpl.getElement(WebElementFacadeImpl.java:229)
at net.serenitybdd.core.pages.WebElementFacadeImpl.sendKeys(WebElementFacadeImpl.java:1292)
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 net.thucydides.core.annotations.locators.AbstractSingleItemHandler.invoke(AbstractSingleItemHandler.java:45)
at com.sun.proxy.$Proxy35.sendKeys(Unknown Source)
at pages.ProxyVoteHomePage.enterControlNumber(ProxyVoteHomePage.java:19)
at stepdefinitions.ProxyVoteStepDef.provide_the_Control_number_as_and_submit(ProxyVoteStepDef.java:49)
at ?.Provide the Control number as "8695024318027023" and submit(file:///C:/Serenity/SerenityBDD/src/test/resources/features/demo.feature:5)

19:57:55.219 [main] DEBUG n.s.core.photography.Darkroom - Opening darkroom
19:57:55.220 [Darkroom Processing Line] DEBUG n.s.c.p.DarkroomProcessingLine - Darkroom processing line starting up
19:57:56.187 [main] DEBUG n.s.core.photography.Darkroom - Send negative for processing for target\site\reports\4c1fe1227df5b141073cd1550a31354aa24c231a350ffa14d2661b5eb54f20be.png
Step argument class io.cucumber.core.gherkin.vintage.GherkinVintageDataTableArgument
Then vote to the given proposal # stepdefinitions.ProxyVoteStepDef.voteToTheProposal(io.cucumber.datatable.DataTable)
Then submit the vote and verifying the confirmation # stepdefinitions.ProxyVoteStepDef.check_the_page_opened_or_not()
This is After Stories Method
This is After Stories Method
1603981676500 Marionette INFO Stopped listening on port 2540

Process finished with exit code -1

org.openqa.selenium.NoSuchElementException: Timed out after 2 seconds. Element not found
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:17:03'
System info: host: 'BGLRT4700245', ip: '10.105.66.37', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: unknown

at net.thucydides.core.annotations.locators.SmartAjaxElementLocator.ajaxFindElement(SmartAjaxElementLocator.java:166)
at net.thucydides.core.annotations.locators.SmartAjaxElementLocator.findElement(SmartAjaxElementLocator.java:118)
at net.serenitybdd.core.pages.WebElementResolverByElementLocator.resolveForDriver(WebElementResolverByElementLocator.java:30)
at net.serenitybdd.core.pages.WebElementFacadeImpl.getResolvedELement(WebElementFacadeImpl.java:234)
at net.serenitybdd.core.pages.WebElementFacadeImpl.getElement(WebElementFacadeImpl.java:229)
at net.serenitybdd.core.pages.WebElementFacadeImpl.sendKeys(WebElementFacadeImpl.java:1292)
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 net.thucydides.core.annotations.locators.AbstractSingleItemHandler.invoke(AbstractSingleItemHandler.java:45)
at com.sun.proxy.$Proxy35.sendKeys(Unknown Source)
at pages.ProxyVoteHomePage.enterControlNumber(ProxyVoteHomePage.java:19)
at stepdefinitions.ProxyVoteStepDef.provide_the_Control_number_as_and_submit(ProxyVoteStepDef.java:49)
at ?.Provide the Control number as "8695024318027023" and submit(file:///C:/Serenity/SerenityBDD/src/test/resources/features/demo.feature:5)

@xMagiciaNx
Copy link

xMagiciaNx commented Dec 4, 2020

I have to say that testing locally and in parallel it's not a recommend method. The browser focus is an important thing when it comes to locating elements and stuff -- hence your element not found errors. Things gettting even worse when it comes to safari browser. You can even see a "Focus Stolen" message in the mac console and the tests are frereezing entirely. I don't thing that is a serenity's problem, rather than it has to do with system internals. You can fire up manually local docker containers to test in parallel, or with an automated way, use your remote web driver smart in your local rig. If you don't want to mess up with complex things and stuff just use selenoid which offers dockerized linux images with the advantage to choose any browser version you want https://aerokube.com/selenoid/latest/ . Aerokube also offers conf manager to fire up containers with 1 line https://aerokube.com/cm/latest/ . VNC video recording and stuff are supported.

Cheers.

@wakaleo wakaleo closed this as completed Feb 12, 2022
@chanduguthikonda
Copy link

@wakaleo Sorry to pickup this old thread. I would like to know if Serenity supports executing a Scenario or a bunch of feature files to execute on multiple browser types(Chrome, Safari, .....) at the same time.
Appreciate your response.
Thank you

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

No branches or pull requests

5 participants