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

Passing the remote debugging port for chromedriver #41

Merged
merged 3 commits into from Oct 21, 2023
Merged

Conversation

jwoertink
Copy link
Contributor

Fixes #40

@jwoertink jwoertink marked this pull request as ready for review October 21, 2023 20:56
Comment on lines +13 to +15
driver1, args1 = Selenium::TestDriverFactory.build(ENV["SELENIUM_BROWSER"]? || "chrome", 9222)
session1 = driver1.create_session(args: args1)
driver2, args2 = Selenium::TestDriverFactory.build(ENV["SELENIUM_BROWSER"]? || "chrome")
driver2, args2 = Selenium::TestDriverFactory.build(ENV["SELENIUM_BROWSER"]? || "chrome", 9223)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The latest Chromedriver seems to not auto increment the debugging port. If these are both set to the same port, then the sessions are duplicated which means visiting a page on one will return that the other also visited that page.

Comment on lines +46 to +48
if session_id.nil?
raise InvalidSessionError.new(data.dig("value", "message").as_s)
end
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 added this because the original error was "Missing key sessionId" which wasn't helpful. Getting the message out here was actually saying "DevToolsActivePort file doesn't exist". Looking that up led me to adding the remote-debugging-port.

@jwoertink jwoertink merged commit ac61510 into master Oct 21, 2023
4 checks passed
@jwoertink jwoertink deleted the issues/40 branch October 21, 2023 21:17
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

Successfully merging this pull request may close these issues.

Missing hash key: "sessionId" (KeyError)
1 participant