Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to switch driver in python selenium

import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By

class GoogleOrgSearch(unittest.TestCase):

     def setUp(self):
         self.driver = webdriver.Firefox()

    def test_google_search_page(self):
         driver = self.driver
         driver.get("http://www.cdot.in")
         window_before = driver.window_handles[0]
         print window_before
         driver.find_element_by_xpath("//a[@href='http://www.cdot.in/home.htm']").click()
         window_after = driver.window_handles[1]
         driver.switch_to_window(window_after)
         print window_after
         driver.find_element_by_link_text("ATM").click()
         driver.switch_to_window(window_before)


    def tearDown(self):
    self.driver.close()

if __name__ == "__main__":
unittest.main()
Comment

PREVIOUS NEXT
Code Example
Python :: what is imageTk in pil python 
Python :: pytesseract.image_to_string save text file 
Python :: How to copy any text using python 
Python :: discord.py embeds 
Python :: pandas slicing from one column to another 
Python :: python version 
Python :: basic calculator in python 
Python :: how to add an item to a list in python 
Python :: how to read excel with multiple pages on pandas 
Python :: connecting python with database 
Python :: deleting dataframe row in pandas based on column value 
Python :: for each loop python 3 
Python :: Converting List to Dataframe Using zip() function 
Python :: django updated_at field 
Python :: python print percent sign 
Python :: get all file in folder python 
Python :: example of django template for forms 
Python :: create new list in for loop python 
Python :: pandas python group by for one column and sum another column 
Python :: python delete key from dictionary 
Python :: python merge two lists alternating 
Python :: python send http request 
Python :: circumference of circle 
Python :: python write list to excel file 
Python :: get dictionary elements by index in python 
Python :: find index of maximum value in list python 
Python :: PIL image example 
Python :: create list of numbers 
Python :: python group by multiple aggregates 
Python :: python font 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =