Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 874 Bytes

README.md

File metadata and controls

35 lines (23 loc) · 874 Bytes

How to handle multiple tabs in automation test in UnitTest on LambdaTest

If you want to handle multiple tabs using an automation test in UnitTest on LambdaTest, you can use the follwing steps. You can refer to sample test repo here.

Code

To open a new tab, you can use the following line of code:

driver.execute_script("window.open('about:blank','secondtab');")

To switch to the new tab, you can use the following line of code:

#by using tab name
driver.switch_to.window("secondtab")

or

#by using tab id
driver.switch_to.window("2")

Run your test

python lambdatest_test.py

Links:

LambdaTest Community