In [1]:
from selenium import webdriver
browser = webdriver.Chrome()
url = "https://offense.roadpolice.am/violation"
browser.get(url)
In [2]:
pin_code = "173679JNYEJM"
In [3]:
input_form = browser.find_element_by_xpath('//*[@id="pin"]')
input_form.send_keys(pin_code)
submit_button = browser.find_element_by_tag_name("button")
submit_button.click()
In [8]:
js = '''html = document.getElementsByTagName('html')[0];
return html.outerHTML;'''
html = browser.execute_script(js).encode('utf-8')
In [9]:
with open("page_source.html","w") as f:
f.write(html)
In [11]:
with open("page_source.html","w") as f:
f.write(browser.page_source.encode('utf-8'))
In [12]:
date = browser.find_element_by_xpath('//*[@id="main_data"]/tbody/tr[6]/td[3]')
print(date.text)
In [13]:
amount = browser.find_element_by_css_selector("li b").text
print(amount)
In [14]:
import re
In [15]:
drams = re.findall("[0-9]+",amount)
print(drams[0])
In [16]:
browser.close()