Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98503

How can I get source code of page from selenium IDE? [duplicate]

$
0
0

I try work with selenium IDE. And this is exported code from IDE:

# Generated by Selenium IDE


class TestSourcecode():
    def setup_method(self, method):
        self.driver = webdriver.Chrome('D:\Downloads\chromedriver_win32\chromedriver.exe')
        self.vars = {}

    def teardown_method(self, method):
        self.driver.quit()

    def test_sourcecode(self):
        self.driver.get("https://www.google.com/")
        self.driver.set_window_size(1086, 602)
        self.driver.find_element(By.NAME, "q").click()
        self.driver.find_element(By.NAME, "q").send_keys("python")
        self.driver.find_element(By.NAME, "q").send_keys(Keys.ENTER)
        element = self.driver.find_element(By.CSS_SELECTOR, "div:nth-child(2) > .rc .LC20lb")
        actions = ActionChains(self.driver)
        actions.move_to_element(element).perform()
        self.driver.find_element(By.CSS_SELECTOR, "div:nth-child(2) > .rc .LC20lb").click()
        element = self.driver.find_element(By.CSS_SELECTOR, "body")
        actions = ActionChains(self.driver)
        actions.move_to_element(element, 0, 0).perform()
        self.driver.page_source()

So how can I get source code of the page(https://www.python.org/)?


Viewing all articles
Browse latest Browse all 98503

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>