when running this mand, I'm getting an error:
driver.find_element_by_link_text("Confirm").click()
seleniummon.exceptions.WebDriverException: Message: unknown error: Element <a href="javascript:void(0);" class="c-button u-fontSize13 c-button--blue transparent-button js-connect-button js-request-connection" data-href="" data-invited-id="5911955">...</a> is not clickable at point (67, 581). Other element would receive the click: `<div class="mfp-container mfp-ajax-holder mfp-s-loading">...</div>`
After searching answers on this issue, I've changed the above code to:
element = driver.find_element_by_link_text("Confirm").click()
driver.execute_script("arguments[0].click();", element)
For the first click it worked and then printed this error:
seleniummon.exceptions.WebDriverException: Message: unknown error: Cannot read property 'click' of null
The HTML code is:
<a href="javascript:void(0);" class="c-button js-close s-vgLeft0_5 c-button--blue" data-modal="true" data-url="">Confirm</a>
when running this mand, I'm getting an error:
driver.find_element_by_link_text("Confirm").click()
selenium.mon.exceptions.WebDriverException: Message: unknown error: Element <a href="javascript:void(0);" class="c-button u-fontSize13 c-button--blue transparent-button js-connect-button js-request-connection" data-href="https://angel.co/user_graph_requests" data-invited-id="5911955">...</a> is not clickable at point (67, 581). Other element would receive the click: `<div class="mfp-container mfp-ajax-holder mfp-s-loading">...</div>`
After searching answers on this issue, I've changed the above code to:
element = driver.find_element_by_link_text("Confirm").click()
driver.execute_script("arguments[0].click();", element)
For the first click it worked and then printed this error:
selenium.mon.exceptions.WebDriverException: Message: unknown error: Cannot read property 'click' of null
The HTML code is:
<a href="javascript:void(0);" class="c-button js-close s-vgLeft0_5 c-button--blue" data-modal="true" data-url="https://angel.co/user_graph_requests/102006082/verify">Confirm</a>
Share
Improve this question
edited Jun 8, 2017 at 14:38
Annie Shlepak
asked Jun 8, 2017 at 14:32
Annie ShlepakAnnie Shlepak
1033 silver badges11 bronze badges
2
-
apparently when you try to click it here:
driver.find_element_by_link_text("Confirm").click()
your link is behind other element. That means you have somehow to bring your element to frontend. This can mean many things (like the page is not fully loaded) without any other info about that is kind of hard to say exactly what's going on – Edwin Commented Jun 8, 2017 at 14:38 - Try to give wait before the click() – Chandra Shekhar Commented Jun 8, 2017 at 14:39
4 Answers
Reset to default 3So this worked for me:
driver.find_element_by_link_text("Confirm").send_keys('\n')
Thanks to everybody :)
Try to search for the class:
driver.find_element_by_class("c-button js-close s-vgLeft0_5 c-button--blue").click()
If you look at the error message, you will see that another element is intercepting the click. I don't know for sure without looking at the page but generally it's something like a loader screen, popup, etc. that appears temporarily and then disappears. There is also the hint of one of the classes of the intercepting DIV, mfp-s-loading
, that further makes me think it's some sort of loading popup. The problem here is that the script proceeds and tries to click the link faster than the popup loads and unloads. What I typically do in a situation like this is to wait for the popup to be invisible and then click the link.
The HTML of the popup is in the error message,
<div class="mfp-container mfp-ajax-holder mfp-s-loading">...</div>
So you can locate the element using a CSS selector like, div.mfp-s-loading
, to wait for it to be invisible and then try your click.
Sometimes using Xpath is easier Try: driver.find_element_by_xpath(Xpath).click()
where Xpath should point to the object which you are planning to click
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745121250a4612425.html
评论列表(0条)