How to get current html data after the method click() in Selenium?

Can connect and follow the link:

from selenium import web driver

driver = webdriver.Firefox()
driver.get("https://www.example.com")
driver.find_element_by_xpath("/html/body/div...]").click()


How to get html from a new page (which has passed) ?
July 8th 19 at 16:02
3 answers
July 8th 19 at 16:04
Solution
Perhaps the problem is that the data has not time to boot
About expectations read here about expectations
I did something like this
from selenium import webdriver
import selenium.webdriver.support.ui as ui

browser = webdriver.Firefox()
wait = ui.WebDriverWait(browser,30)
browser.execute_script(")#the script was switching to another page in my case so your on the other (driver.find_element_by_xpath("/html/body/div...]").click())
wait.until(lambda browser: browser.find_element_by_id('someID'))
some_info = browser.find_element_by_id('someID').get_attribute("outerHTML")
July 8th 19 at 16:06
Found this: How to get Selenium to wait for page load after a click, but not yet understood.
July 8th 19 at 16:08
driver.current_url?
1. Need html 2. Need current data, and it gives the data of the previous page. - Otha_Beahan commented on July 8th 19 at 16:11
Oh, sorry, didn't read) apparently need to wait until the data you see. And apparently the fact that you found it and have seen examples in C#, also used. - Titus_Kuhlman76 commented on July 8th 19 at 16:14
: there's only pieces of code, I can not yet understand - Otha_Beahan commented on July 8th 19 at 16:17
: example here
stackoverflow.com/questions/15122864/selenium-wait... - Titus_Kuhlman76 commented on July 8th 19 at 16:20
: here is the same as in the blog, nifiga not clear, pieces of code. It is necessary: to open the page - find the link here - click on it to get the html from a new page. I would be very grateful if you help a real example. - Otha_Beahan commented on July 8th 19 at 16:23
: it's working, but not on all sites. There are links which take you to only specific pages. In such cases, crashes error: Timeout waiting for page_has_loaded - Otha_Beahan commented on July 8th 19 at 16:26
: timeout to try can be increased. Well, or throw from where you need to go, will check later if you fail - Titus_Kuhlman76 commented on July 8th 19 at 16:29

Find more questions by tags ParsingSeleniumPython