0

I am currently trying to automate Job Applications on the indeed website using selenium.

My issue is I have tried selecting the element using the XPath, CSS selectors,Classname. The UI shows the continue button is to be clicked to move to the next page.

It still throws the exception that the element cannot be found.

This is the HTML code:

<button class="ia-continueButton ia-ContactInfo-continue css-vw73h2 e8ju0x51">
    <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="ifl-Spinner-title-470" class="css-qg4x0n e150lnaj2">
        <title id="ifl-Spinner-title-470">loading</title>
        <circle cx="50" cy="50" r="45" class="css-1s13iyj e150lnaj1"></circle>
        <circle cx="50" cy="50" r="45" class="css-41looc e150lnaj0"></circle>
    </svg>
    <div style="visibility: visible;">Continue</div>
</button>

This is my selenium code selecting the button element to take me to the next page.

continue_send_key = driver.find_element(By.CSS_SELECTOR, "#ia-container > div > div.css-15aza98.eu4oa1w0 > div > main > div.css-15adxh0.e37uo190 > div.css-t4lkhd.eu4oa1w0 > div > div > div.ia-BasePage-footer.fs-unmask > div > button")
continue_send_key.click()
time.sleep(10)

This is the link to the indeed: https://m5.apply.indeed.com/beta/indeedapply/form/contact-info

Please help with suggestions to fix. The automation worked smoothly till this point.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
CitronW
  • 3
  • 3

1 Answers1

0

The desired element is a dynamic element, so to click on the clickable element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:

  • Using CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button.ia-continueButton.ia-ContactInfo-continue div"))).click()
    
  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[contains(@class, 'ia-ContactInfo-continue')]//div[text()='Continue']"))).click()
    
  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • That wasnt able to fix the issue. It gets to the line of code, waits for 20 secs and throws a timeout error. – CitronW Jan 25 '23 at 17:03
  • Is it possible that some html elements cannot be automated? This is my first time encountering this issue – CitronW Jan 25 '23 at 17:03
  • Check if the desired element is within an [**iframe**](https://stackoverflow.com/a/53276478/7429447) or within a [**shadowRoot**](https://stackoverflow.com/a/73242476/7429447) – undetected Selenium Jan 25 '23 at 19:32
  • I don't think so. Can I add a photo or screen recording of the HTML code so you can have a look? I can also post on Twitter if you'd like or any CDN of your choice. – CitronW Jan 25 '23 at 21:48