Skip to content Skip to sidebar Skip to footer

How To Open Two Links On The Same Browser

I need to open 2 Invoices the one's whose GST Invoice number contains digit 2 at it's third place. I modified the as following: from selenium import webdriver from selenium.webdriv

Solution 1:

It is working fine.. with the following code.. I already checked it. It opened both of the pdfs in two different tabs.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC

def chrome_arguments():
    user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'
    options= webdriver.ChromeOptions()
    options.add_argument('--incognito')
    options.add_experimental_option("excludeSwitches", ["enable-automation"])
    options.add_experimental_option('useAutomationExtension', False)
    options.add_argument("--disable-plugins-discovery")
    options.add_argument('--disable-extensions')
    options.add_argument('--profile-directory=Default')
    options.add_argument("--start-maximized")
    options.add_argument("--no-sandbox")
    options.add_argument('--ignore-certificate-errors')
    options.add_argument('--safebrowsing-disable-download-protection')
    options.add_argument('--safebrowsing-disable-auto-update')
    options.add_argument('--disable-client-side-phishing-detection')
    options.add_argument(f'user-agent={user_agent}')
    
    return options
    
driver = webdriver.Chrome(executable_path='',options=chrome_arguments()) 

driver.get("URL")



WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//input[@id='PNRId']"))).send_keys("SHFYGW")
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='GstRetrievePageInteraction']"))).click()

toJourney=WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, "table.gst-table-view")))

toJourney.find_element_by_xpath('tbody/tr/td[2]/ul[1]/li[2]/a[1]').click()

toJourney.find_element_by_xpath('tbody/tr/td[2]/ul[3]/li[2]/a[1]').click()

Post a Comment for "How To Open Two Links On The Same Browser"