Title

selenium切换选项卡

### selenium切换选项卡

```python
selenium切换选项卡
brower = webdriver.Chrome()
brower.get('https://www.pearvideo.com/')
brower.implicitly_wait(10)
brower.maximize_window()
print(brower.window_handles)
brower.execute_script('window.open()')

brower.switch_to.window(brower.window_handles[1])  # 切换到选项卡
brower.get('http://www.taobao.com')
time.sleep(3)

brower.switch_to.window(brower.window_handles[0])  # 切换到第一个选项卡
brower.get('http://www.baidu.com')
time.sleep(2)
brower.close()
posted @ 2023-07-11 18:09  哈哈哈哼  阅读(43)  评论(0编辑  收藏  举报