two webdriver question #1235
Answered
by
mdmintz
c350147221
asked this question in
Q&A
-
hi. |
Beta Was this translation helpful? Give feedback.
Answered by
mdmintz
Feb 25, 2022
Replies: 1 comment
-
Use the Example: https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_multiple_drivers.py from seleniumbase import BaseCase
class MultipleDriversTest(BaseCase):
def test_multiple_drivers(self):
self.open("data:text/html,<h1>Driver 1</h1>")
driver2 = self.get_new_driver()
self.open("data:text/html,<h1>Driver 2</h1>")
self.switch_to_default_driver() # Driver 1
self.highlight("h1")
self.assert_text("Driver 1", "h1")
self.switch_to_driver(driver2) # Driver 2
self.highlight("h1")
self.assert_text("Driver 2", "h1")
self.get_new_driver(
browser=None,
headless=None,
locale_code=None,
protocol=None,
servername=None,
port=None,
proxy=None,
proxy_bypass_list=None,
agent=None,
switch_to=True,
cap_file=None,
cap_string=None,
recorder_ext=None,
disable_csp=None,
enable_ws=None,
enable_sync=None,
use_auto_ext=None,
no_sandbox=None,
disable_gpu=None,
incognito=None,
guest_mode=None,
devtools=None,
remote_debug=None,
swiftshader=None,
ad_block_on=None,
block_images=None,
chromium_arg=None,
firefox_arg=None,
firefox_pref=None,
user_data_dir=None,
extension_zip=None,
extension_dir=None,
external_pdf=None,
is_mobile=None,
d_width=None,
d_height=None,
d_p_r=None,
) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mdmintz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the
self.get_new_driver()
method when opening a new driver. If there's an error, the screenshot will be taken on the latest-used driver.Example: https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_multiple_drivers.py