Python — Opening multiple tabs using Selenium

后端 未结 3 1385
天命终不由人
天命终不由人 2020-12-09 12:44

I am using Python. I am trying to open two tabs on chrome, each to a different website. This is my code:

from selenium import webdriver
from selenium.webdriv         


        
3条回答
  •  春和景丽
    2020-12-09 13:19

    You should switch to other tab to interact with it.

    ArrayList tabs = new ArrayList (driver.getWindowHandles());
    driver.switchTo().window(tabs.get(0));//first tab
    driver.switchTo().window(tabs.get(1));//second tab
    

提交回复
热议问题