Collections:
Retrieve Web Page Title with WebDriver in Python
How to Retrieve Web Page Title with Selenium WebDriver in Python?
✍: FYIcenter.com
Once you have connected to the Web browser using the Selenium WebDriver,
you can open any remote Web page and retrieve its page title as shown in this tutorial.
3 main methods from the Selenium WebDriver class will be used:
3. Make sure the browser driver is accessible:
C:\fyicenter>chromedriver --version ChromeDriver 75.0.3770.90 (...)
2. Enter the following program, GetPageTitle.py, that retrieve Web page title:
C:\fyicenter> type GetPageTitle.py
# GetPageTitle.py
# Copyright (c) FYIcenter.com
from selenium.webdriver import Chrome
driver = Chrome()
driver.get("http://sqa.fyicenter.com")
title = driver.title
driver.quit();
print("Test Case - Verify Page Title:")
print(" Actual Value: "+title)
print(" Expected Value: FYI Center...")
if (title.startswith("FYI Center")):
print(" Test Result: Passed")
else:
print(" Test Result: Failed")
3. Run it on the Python engine:
C:\fyicenter>python GetPageTitle.py DevTools listening on ws://127.0.0.1:57633/devtools/browser/... Test Case - Verify Page Title: Actual Value: FYI Center for Software QA Testing Expected Value: FYI Center... Test Result: Passed
As you can see, the GetPageTitle.py test script works nicely.
⇒ Retrieve Web Form Elements with WebDriver in Python
⇐ Load WebDriver for Different Browsers in Python
2019-10-27, 1757🔥, 0💬
Popular Posts:
How to generate ISBN numbers? To help you to obtain some ISBN numbers for testing purpose, FYIcenter...
Where to find online test tools? FYIcenter.com has prepared a number of online test tools: Data Look...
Why I am getting gzip compressed HTTP response in SoapUI? If you run a HTTP request for some Website...
How to perform UUDecode (Unix-to-Unix Decode)? UUEncode is Unix-to-Unix encoding used on Unix system...
How to generate email addresses? To help you to obtain some email addresses for testing purpose, FYI...