-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckNct.py
31 lines (29 loc) · 1.41 KB
/
checkNct.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.support import expected_conditions as expected
from selenium.webdriver.support.wait import WebDriverWait
from selenium.common.exceptions import TimeoutException
import time
text = raw_input()
if __name__ == "__main__":
options = Options()
options.add_argument('-headless')
driver = Firefox(executable_path='geckodriver', firefox_options=options)
try:
driver.get('https://www.ncts.ie/1263')
driver.find_element_by_xpath("//button[@id='CloseCookie']").click()
driver.refresh()
nctInput=driver.find_element_by_xpath("//input[@name='RegistrationID']")
nctInput.clear()
nctInput.send_keys(text+ Keys.ENTER )
WebDriverWait(driver, 10).until(expected.presence_of_element_located((By.ID, "confirmVehicleYes")))
driver.find_element_by_xpath("//input[@id='confirmVehicleYes']").send_keys(Keys.ENTER)
WebDriverWait(driver, 10).until(expected.presence_of_element_located((By.ID, "tab3")))
print (driver.find_element_by_xpath('//*[@id="tab3"]/form[1]/div[2]/div[1]/div[1]/table/tbody/tr[1]/td').text)
except TimeoutException as ex:
print 'Invalid reg plate/Script crash'
isrunning = 0
driver.quit()
driver.quit()