2018-03-05 04:00:31 +08:00
|
|
|
import time
|
|
|
|
from seleniumbase import BaseCase
|
|
|
|
|
|
|
|
|
|
|
|
class MyTestClass(BaseCase):
|
|
|
|
|
|
|
|
def test_proxy(self):
|
|
|
|
self.open('https://ipinfo.io/')
|
2018-06-18 02:42:12 +08:00
|
|
|
ip_address = self.get_text("div.home-ip-details span.value")[1:-1]
|
2019-08-06 13:39:32 +08:00
|
|
|
print("\n\nMy IP Address = %s\n" % ip_address)
|
2018-03-05 04:00:31 +08:00
|
|
|
print("Displaying Host Info:")
|
2021-02-25 15:34:07 +08:00
|
|
|
text = self.get_text('div.home-ip-details').split('asn:')[0]
|
|
|
|
rows = text.split('\n')
|
|
|
|
data = []
|
|
|
|
for row in rows:
|
|
|
|
if row.strip() != "":
|
|
|
|
data.append(row.strip())
|
|
|
|
print("\n".join(data).replace('\n"', ' '))
|
2018-03-05 04:00:31 +08:00
|
|
|
print("\nThe browser will close automatically in 7 seconds...")
|
|
|
|
time.sleep(7)
|