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/)?