Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Init driver before start #973

Answered by mdmintz
AndrejSayadov asked this question in Q&A
Discussion options

Hello! Can I immediately redefine driver before starting? Now I'm stopping the old driver and connecting a new one to it. I want to immediately specify the necessary driver.
image

You must be logged in to vote

You should always use self.driver.quit() instead of self.driver.close(), because otherwise you might leave open running processes. That being said, running the above code from your example will lose all the SeleniumBase settings that are set when the browser is launched. In your particular case, you may want to fork/clone SeleniumBase and then go into seleniumbase/core/browser_launcher.py and replace from selenium import webdriver with from seleniumwire import webdriver so that you can run your specific seleniumwire code. But if you don't care about the SeleniumBase default options, then you can probably do what you're trying to do now if you include from seleniumwire import webdriver in ...

Replies: 1 comment

Comment options

You should always use self.driver.quit() instead of self.driver.close(), because otherwise you might leave open running processes. That being said, running the above code from your example will lose all the SeleniumBase settings that are set when the browser is launched. In your particular case, you may want to fork/clone SeleniumBase and then go into seleniumbase/core/browser_launcher.py and replace from selenium import webdriver with from seleniumwire import webdriver so that you can run your specific seleniumwire code. But if you don't care about the SeleniumBase default options, then you can probably do what you're trying to do now if you include from seleniumwire import webdriver in your example and then run the code you had.

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /