skip to Main Content

I am currently in the process of making a program to login into selenium and pass the verification. I have the rest of the program thought out and prepared but no matter what I do to click the verify button whether it be by ID or by the text inside, the button won’t click. I ran something into the console to check how many elements had that id and it said only 1.

Here is the line of code that is not working, everything else like the login is working perfectly fine.

WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.ID, "home_children_button"))).click()

enter image description here

EDIT:
After reading the html there seemed to be multiple iframes as pointed out by @ryyyn
but after running something into the console, it only returned one. Now im even more confused than before and am unsure of what to do now.

enter image description here

2

Answers


  1. I have encountered similar situations, and in my opinion, it is likely an iframe issue. You can try the following approach:

    from selenium.webdriver.common.by import By
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    
    # ... after open the page of verification..
    
    # Wait for the iframe to be present and switch to it
    WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.TAG_NAME, "iframe")))
    
    # Locate the button inside the iframe
    verify_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Verify']")))
    
    # Click the button
    verify_button.click()
    

    I also recommend debugging the WebDriver elements after attempting to select the element. This can help ensure you’re correctly interacting with the desired elements.

    Login or Signup to reply.
  2. The purpose of this page is to stop you from doing what you’re doing. The "Verify" button is a test to detect whether or not you are using a bot. Since you are using a bot to click the button, it doesn’t allow you to proceed.

    Interestingly, you mentioned that it works for you to manually click the button in a browser driven by Selenium. This means that the bot detection is not using a simple approach which can easily be bypassed. ReCAPTCHA works by tracking how your mouse moves before and after you click the button; I would guess that this is doing something similar.

    Also, what you’re attempting to do is against LinkedIn TOS, just as a heads up.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search