SeleniumBase/examples/test_agent.py

13 lines
391 B
Python
Executable File

from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_user_agent(self):
self.open('http://whatsmyuseragent.org/')
user_agent = self.get_text(".user-agent p")
print("\n\nUser-Agent:\n%s\n" % user_agent)
print(self.get_text(".ip-address p"))
print("\nThe browser will close automatically in 7 seconds...")
self.sleep(7)