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

Update to run multiple instances of same webdriver #30

Conversation

Dakad
Copy link
Contributor

@Dakad Dakad commented May 5, 2023

Fixes #21

Description

This PR is a fix for #21 and an attempt to resolve #24.
This PR changes update the Service.start to check if the default port assigned to the browser service is available or not.
If not, it will keep increasing the port number until we found an open port and use it to run the driver bin command
This will change will allow multiple instances to run the same browser on different ports, each one with its own context/session. It's very helpful when using Fiber 🎉

How it was tested?

Locally by running SELENIUM_BROWSER=firefox crystal spec -DDEBUG --error-trace spec/features/session_spec.cr

driver1.try &.stop
session2.try &.delete
driver2.try &.stop
TestServer.reset
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I encountered this error after running the specs. The TestServer port remains open after the test.
It doesn't happen all the time though.
image

Dakad added a commit to Dakad/webdriver_pump that referenced this pull request May 6, 2023
Dakad added a commit to Dakad/webdriver_pump that referenced this pull request May 6, 2023
@matthewmcgarvey matthewmcgarvey merged commit c73022f into crystal-loot:master May 8, 2023
@Dakad Dakad deleted the feature/use-service-on-another-port-if-taken branch May 8, 2023 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants