0

I'm trying to click a href link like this below;

<span class="clearForm">
<a href="#" onclick="mojarra.jsfcljs(document.getElementById('form'),{'j_idt686':'j_idt686'},'');return false" class="btn btn-sm NSWbtn3">
Update</a>
</span>

I can catch the link with using css selector. But click function is not running because of onclick javascript call. How can I click on this link?

upd_button = self.browser.find_element_by_css_selector("a.btn.btn-sm.NSWbtn3")
upd_button.click()

1 Answer 1

1

Interesting that the onclick() is not running. Let's try using a different selector type and see if that helps.

self.browser.find_element_by_xpath("//a[contains(text(), 'Update')]").click()
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks @Christine. I tried this one but no luck : ( Another link is clicked with this way not mine. When I try arguments[1].click(); nothing happened.
Interesting. instead of find_element_by_css_selector, could you try find_element_by_xpath("//a[contains(text(), 'Update')]").click() ?
It worked! Could you post this one then I can check as an answer. Thank you very much. You are the man!
@Jack that's great news, happy to help. I've updated my answer with the proper solution.

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.