Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to switch tabs in selenium

Set<String> handle = driver.getWindowHandles();

		Iterator<String> it = handle.iterator();

		String parentId = (it.next());
		System.out.println("parenWidowId" + parentId);

		String childId = (it.next());
		System.out.println("childWindowId" + childId);

		driver.switchTo().window(childId);
		
Comment

selenium python switch tabs

from selenium import webdriver
import time

driver = webdriver.Chrome(executable_path="C:chromedriver.exe")
driver.get("https://accounts.google.com/signup")

driver.find_element_by_link_text("Help").click()

#prints parent window title
print("Parent window title: " + driver.title)

#get current window handle
p = driver.current_window_handle

#get first child window
chwd = driver.window_handles

for w in chwd:
#switch focus to child window
    if(w!=p):
    driver.switch_to.window(w)
break
time.sleep(0.9)
print("Child window title: " + driver.title)
driver.quit()
Comment

PREVIOUS NEXT
Code Example
Python :: use proxy to connect smtp python 
Python :: is in python 
Python :: flask bootstrap 
Python :: register template tag django 
Python :: how does HTTPServer work in python 
Python :: numpy loadtxt skip header 
Python :: list all files in folder python 
Python :: pandas write csv 
Python :: python check if input() gives error 
Python :: python chat 
Python :: how to run loops 3 times in python 
Python :: pycord discord discordpy get total slash commands and total commands regestered in your bot 
Python :: csv download django 
Python :: python subset 
Python :: how to take array as input in python 
Python :: create virtual env pyhton3 
Python :: How to Get the Union of Sets in Python 
Python :: how to use %s python 
Python :: get method in python dictionary 
Python :: mount gdrive in pyton 
Python :: new column with addition of other columns 
Python :: remove all elements from list python by value 
Python :: how to append number in tuple 
Python :: python random number generator no duplicates 
Python :: scree plot sklearn 
Python :: concatenation of array in python 
Python :: pandas drop duplicates but keep most recent date 
Python :: list pakages installed in python 
Python :: python call function x number of times 
Python :: group by dateime pandas 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =