0

I'm trying to automate a task where I need to input service tags in the dell support page and extract the laptop information. But sometimes when I try to submit, the webpage shows a validation pop-up and it has a waiting time of 30 seconds

enter image description here

Does anyone have any suggestions on how to bypass this validation? Here is what I tried.

url = 'https://www.dell.com/support/home/en-in'
driver = webdriver.Chrome()
for service_tag in ['JX0JL13', '20M11J3', 'BH7C3M2', '6MYH5S2']:
    driver.get(url)
    input_element = driver.find_element(by=By.XPATH, value='//*[@id="inpEntrySelection"]')
    input_element.send_keys(service_tag)
    driver.find_element(by=By.XPATH, value='//*[@id="btn-entry-select"]').click()
    model = driver.find_element(by=By.XPATH, value='//*[@id="site-wrapper"]/div/div[4]/div[1]/div[2]/div[1]/div[2]/div/div/div/div[2]/h1').text
    print(model)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

2 Answers2

1

Ran into a very similar issue of Popup occurring every few searches.

Successful way that I found was by using the other search bar, at the top of the page. Have been able to run few hundred serial Numbers without a popup occurring once; have a feeling its trigger is linked to the main search bar.

After the search you can scrape for whatever data you want and then I recommend reloading the landing page and going and doing your next serial number.

Dell Top searchbar

I've also added a couple** addition option features (using a chrome profile 1 or 2). Might encounter an Access denied page a couple times, but just reload program w/ a different profile does the trick.

** total list is 9 arguments, including loading user_agents for every run - may need to import a couple things like keys and userAgent for all this to work but try first 5 lines of code n see how you go.

#iterate through using this
driver.find_element(By.XPATH, "//*[id='md-search-input']").send_keys(serial_num_iteration + Keys.RETURN)
#Scrape the data you want here
time.sleep(3)
driver.get(url)

#Adds profile to driver
options.add_argument(r"--user-data-dir=C:\User\userprofile\AppData\Local\Google\Chrome\User Data")
options.add_argument(r"--profile-directory=Profile 2")

#Adds extra bits to driver
options.add_argument("windows-size 1400, 900")
options.add_argument(f"user-agent={user_agent}")
options.add_argument("--disabe-blink-features=AutomationControlled")
options.add_argument("disable-infobars")
options.add_experimental_option("useAutomationExtension", False)
options.add_argument("--no-sandbox")
16BitBlank
  • 41
  • 4
0

You are seeing the validation pop-up with a waiting time of 30 seconds

popup

possibly as the ChromeDriver initiated Chrome Browser browsing context is geting detected as a .


Solution

A potential solution would be to keep the ChromeDriver synchronized with the browsing context inducing WebDriverWait for the desired clickable elements to turn element_to_be_clickable() and you can use the following locator strategies:

  • Code block:

    driver = webdriver.Chrome(service=s, options=options)
    url = 'https://www.dell.com/support/home/en-in'
    for service_tag in ['JX0JL13', '20M11J3', 'BH7C3M2', '6MYH5S2']:
        driver.get(url)
        WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//input[@id="inpEntrySelection"]'))).send_keys(service_tag)
        WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//button[@id="btn-entry-select"]//span'))).click()
        print(WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.product-support-hero div.product-summary h1"))).text)
    
  • Console output:

    Latitude 7400
    Latitude 7420
    Latitude 7480
    Latitude 7490
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • awesome. But you are using the service and options argument in the web driver. Could you tell me what are the services and options you are using? I'm guessing `useAutomationExtension` !! – Arunakiri Venkatachalam Aug 18 '22 at 04:56