首页 > 解决方案 > How to click a span text using selenium Python

问题描述

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

标签: pythonseleniumselenium-webdriverxpath

解决方案


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.


推荐阅读