Try adding the following to stop the website from knowing it's a bot.
from selenium.webdriver.chrome.options import Options
options.add_argument('--disable-blink-features=AutomationControlled')
driver = webdriver.Chrome(executable_path=r'D:/Chrome driver/chromedriver.exe',options=options)
Now for the following:
wait = WebDriverWait(driver, 10)
driver.get("link")
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='PNRId']"))).send_keys("QPDYUX")
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='GstRetrievePageInteraction']"))).click()
elements = wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".gst-invoice-list.list-inline")))
for elem in elements:
print(elem.text)
Outputs:
GST Invoice No. View/Print
MH1202106AB57221 View Invoice Print Invoice
MH2202106AB78553 View Invoice Print Invoice
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…