Reputation: 33
I'm currently using this method to refresh the page when a URL is loaded.
if driver.current_url == URL: driver.refresh()
Is there an API method I can use so that if the page title matches a specific word then driver.refresh()
Upvotes: 2
Views: 6634
Reputation: 8209
Use driver.title
if "Python" in driver.title:
driver.refresh()
Or, ofc, strict equality:
if "Python" == driver.title:
driver.refresh()
As a tip, you can inspect what else driver
contains, by printing the following function call to the console: print(dir(driver))
. You'll see stuff like current_url
, title
, refresh
and so on, and might save you time.
Upvotes: 8