You need to access the page_source
property:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http://example.com")
html_source = browser.page_source
if "whatever" in html_source:
# do something
else:
# do something else
More Related Contents:
- ChromeDriver Error: ‘chromedriver’ executable needs to be in PATH [duplicate]
- selenium in python : NoSuchElementException: Message: no such element: Unable to locate element
- Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
- How to configure ChromeDriver to initiate Chrome browser in Headless mode through Selenium?
- unknown error: session deleted because of page crash from unknown error: cannot determine loading status from tab crashed with ChromeDriver Selenium
- How to get attribute of element from Selenium?
- ‘Webdrivers’ executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
- How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium
- Filling in login forms in Instagram using selenium and webdriver (chrome) python OSX
- Clicking on Get Data button for Monthly Settlement Statistics on nseindia.com doesn’t fetch results using Selenium and Python
- Selenium and iframe in html
- Downloading file to specified location with Selenium and python
- Expected conditions in protractor
- How to rotate Selenium webrowser IP address
- How do you fix the “element not interactable” exception?
- How to open multiple webpages in separate tabs within a browser using selenium-webdriver and python
- Selenium – MoveTargetOutOfBoundsException with Firefox
- How to open a link embeded in a webelement with in the main tab, in a new tab of the same window using Control + Click of Selenium Webdriver
- Selenium testing without browser
- How to ignore zoom setting
- OSError: [Errno 8] Exec format error with GeckoDriver and Selenium on MacOS
- Python and how to get text from Selenium element WebElement object?
- How to test non-standard drop down lists through a crawler using Selenium and Python
- How can I get text of an element in Selenium WebDriver, without including child element text?
- Python selenium: wait until element is clickable – not working
- How locate the pseudo-element ::before using Selenium Python
- How can we use Selenium Webdriver in colab.research.google.com?
- Selenium – visibility_of_element_located: __init__() takes exactly 2 arguments (3 given)
- How to locate the First name field within shadow-root (open) within the website https://www.virustotal.com using Selenium and Python
- What is unittest in selenium Python?