“jendela baru selenium python” Kode Jawaban

cara beralih driver di 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()
Better Boar

jendela baru selenium python

# Opens a new tab
self.driver.execute_script("window.open()")

# Switch to the newly opened tab
self.driver.switch_to.window(self.driver.window_handles[1])
talhapythoneer

Jawaban yang mirip dengan “jendela baru selenium python”

Pertanyaan yang mirip dengan “jendela baru selenium python”

Lebih banyak jawaban terkait untuk “jendela baru selenium python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya