I am using selenium and python to learn about automation web testing.
I want to click on "Continue" button, while there is only span in it (I had learned that using id instead of span is so much easier) but in this case, I want to click the span.
I am using below code:
driver.find_element_by_xpath("//span[contains(@class,'mdBtn01Txt')][contains(text(),'Continue')]").click()
here is the element :
<div class="mdLYR12Inner01">
<a class="MdBtn01 mdBtn01 ExDisabled FnSubmitBtn" style="display:none" href="#" onclick="charge(this); return false;">
<span class="mdBtn01Inner">
<span class="mdBtn01Txt">
Continue <<<(I want to click this button)
</span>
</span>
</a>
</div>
</footer>
But, I got this message below:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//span[contains(@class,'mdBtn01Txt')][contains(text(),'Continue')]"}
driver.find_element_by_css_selector(".mdBtn01Txt").click()raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".mdBtn01Txt"}