79290045

Date: 2024-12-18 05:16:55
Score: 3
Natty:
Report link

The following is an example seleniumbase python script. The second print(html) is not correct because the screen changed, and it is still printing the same initial html. The url remains the same on the browser navigation bar for both cases before and after the button is clicked.

How do I retrieve the final html after the button is clicked?

self.open("https://www.example.com/dashboard")
url = self.get_current_url()
print(url)      # Prints https://www.example.com/dashboard, which is correct
html = self.get_page_source()
print(html)    # Prints the initial html of https://www.example.com/dashboard, which is correct

self.click("//span[contains(.,'Change Screen Button')]")
url = self.get_current_url()
print(url)     # Prints https://www.example.com/dashboard, which is correct since the url remains the same on the browser navigation bar, even though the screen changed
html = self.get_page_source()
print(html)    # Prints the initial html of https://www.example.com/dashboard, which is incorrect
Reasons:
  • Blacklisted phrase (1): How do I
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: George