1

I have been trying to use selenium python to click the continue button in Login Page from the below link.

https://www.makemytrip.com

I have tried several selectors, xpath..nothing seems working for me.

This is the element I am trying to click on:

driver.find_element_by_xpath("//span[text()='Continue']").click()

Tried with Div class too:

driver.find_element_by_xpath("//div[contains(@class, 'appendBottom25 ')]")

I expect the selenium to click the continue button and to load to the password page

3
  • What's the error message shown? Commented Oct 16, 2019 at 10:13
  • it doesn't show any error messages. The page stays till the username keys Commented Oct 16, 2019 at 10:16
  • @user10813834 : can you try my solution ... I got the fix ? Commented Oct 16, 2019 at 10:53

3 Answers 3

3

You are using right xpath

Solution :

perform the click operation twice :

element =driver.find_element_by_xpath("//span[text()='Continue']")

element.click()
element.click()

It is a strange solution but .. I got solved this problem same way only.

Sign up to request clarification or add additional context in comments.

2 Comments

Perfect !! it works . But why it works for 2 clicks
@user10813834 : I am looking into it ... Will let you know .. if i got something
0

try this one:

driver.find_element_by_xpath("//*[@id="SW"]/div[2]/div[2]/div[2]/section/form/div[2]/button/span").click()

if you choose to find element by xpath you have to pass as argument the xpath. (you right-click on the continue button > inspect > and then right click on the elemnt that marked > copy xpath)

3 Comments

I have tried but the page not moving after entering the username and no error message too
try these too: driver.find_element_by_xpath("//*[@id="SW"]/div[2]/div[2]/div[2]/section/form/div[2]/button").click() driver.find_element_by_xpath("/html/body/div[1]/div/div[1]/div[2]/div[2]/div[2]/section/form/div[2]/button").click()
It says Unable to locate element: //*[@id='SW']/html/body/div[1]/div/div[1]/div[2]/div[2]/div[2]/section/form/div[2]/button
0

I think you should click on "button".

Try to use xpath below:

//button[./span[text()='Continue']]

And use explicit wait to wait element to be clickable.

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[./span[text()='Continue']]"))).click()

Comments

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.