1

I have been trying for a while now but can't seem to find this element using python selenium. All methods I used whether they were find with xpath, css selector, and or class came back negative so does anybody know how to find and click the element in the middle that has the value "LOG IN" and the type "button"?

<div id="62b00cbb-fb56-4b15-80bb-a8f965d02d90" class="nike-unite-submit-button loginSubmit nike-unite-component blurred">
 <input id="019a8673-60aa-4b9f-825a-00b01ad36507" type="button" value="LOG IN"> # Click This
</div>

I just can't seem to find it so any and all help is appreciated, thanks!

firefox_options = webdriver.FirefoxOptions()
driver = webdriver.Firefox(firefox_options=firefox_options)
driver.get('https://www.nike.com/launch/?cp=usns_aff_nike&s=upcoming')
time.sleep(.2)
logIn = driver.find_element_by_css_selector('#root > div > div > div.main-       layout > div > header > div.d-sm-h.d-lg-b > section > ul > li.member-nav-item.d-sm-ib.va-sm-m > button')
logIn.click()
time.sleep(.2)
email = driver.find_element_by_name('emailAddress')
email.send_keys('email')
passWord = driver.find_element_by_name('password')
passWord.send_keys('password')

# Find and click element from above

Everything else works fine its just when it comes to the select login button. Here is the code just in case their could be something wrong with it or somebody wanted to check it out, thanks

1
  • Show us exactly what you have tried so far. Commented Aug 3, 2018 at 6:45

2 Answers 2

1

To invoke click() on the element with text as LOG IN you need to induce WebDriverWait for the element to be clickable and you can use either of the following solutions:

  • css_selector:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.nike-unite-submit-button.loginSubmit.nike-unite-component.blurred > input[value='LOG IN']"))).click()
    
  • xpath:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='nike-unite-submit-button loginSubmit nike-unite-component blurred']/input[@value='LOG IN']"))).click()
    
Sign up to request clarification or add additional context in comments.

5 Comments

It's coming back with errors for both. When you click log in a pop up appears so maybe the pop up isn't part of the driver? I don't know why it wont find the login button but yet can find the password and email input
Check out my updated answer and let me know the status.
I added it and it seems that the element doesn't become clickable. The log in window just stays up waiting not clicking submit until it returns this error selenium.common.exceptions.TimeoutException: Message:
@JohnDeBritto Update the question with a bit more of the relevant HTML and ensure that the elements are not within an iframe.
It's ok I searched and found a log in script on github and found the element find I was looking for: driver.find_element_by_xpath("""//*[@id="nike-unite-loginForm"]/div[6]/input""").click(). Thank you though you were very helpful
0

You can find the button by using the ID of the button and then click it:

button = driver.find_element_by_id('019a8673-60aa-4b9f-825a-00b01ad36507')
button.click()

Here, driver is your browser webdriver.

2 Comments

selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="019a8673-60aa-4b9f-825a-00b01ad36507"] This error pops up when I run it
It seems it can't find it using id but it can find the password and email address input. Maybe since its a popup its not part of the driver object?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.