Jump to content

WebDriver UDF cannot click element - (Moved)


Efo74
 Share

Recommended Posts

 

Hi, I have been testing this library for a few days and it is very promising. I want to acquire the information contained on a website. I have a list of elements that I can browse, but I cannot click with the mouse on these lines of the list. Can someone help me ?

#include "wd_core.au3"
#include "wd_helper.au3"

Func SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}'
EndFunc

Local $sDesiredCapabilities, $sSession

SetupChrome()

_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)

_WD_Navigate($sSession, "https://internetlink.demo")

for $i=1 to 10
$sSearch = "/html[@id='ng-app']/body[@id='home']/div[@class='main main_white ng-scope']/section[@id='content']/div[@class='container']/div[@class='row'][2]/div[@class='col-md-12']/ul[@class='list-group']/li[@class='list_row ng-scope'][" & $i & "]/a[@class='list-group-item list-group-item-info dropdown-header']"
_WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,$sSearch) ;works
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sSearch);works
_WD_HighlightElement($sSession, $sElement,2);works

    If @error = $_WD_ERROR_Success Then
    _WD_ElementAction($sSession, $sElement, 'click');not working
    EndIf

Next

 

:rolleyes:

Link to comment
Share on other sites

Thank you Danp2 for your support. The link is a dummy link not real. I prefer not expose the public link. This is the scite  output for the last commands.

_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"450fdd47-d543-4565-b375-9d72a5819110"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/ead5be915521cf986422c5d2f8b2f2a8/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"450fdd47-d543-4565-b375-9d72a5819110"}]}
__WD_Post: StatusCode=200; ResponseText={"value":true}
_WD_ExecuteScript: {"value":true}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/ead5be915521cf986422c5d2f8b2f2a8/element/450fdd47-d543-4565-b375-9d72a5819110/click; $sData={"id":"450fdd47-d543-4565-b375-9d72a5819110"}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"element click intercepted","message":"element click intercepted: Element \u003Ca class=\"list-group-item list-group-item-info dropdown-header\" role=\"menuitem\" tabindex=\"-1\" href=\"\" ng-click=\"showDetail(dummy.crm)\" index=\"0\" scrolltopview=\"\" style=\"background: rgb(255, 255, 102); border-radius: 5px; padding-left: 3px;\">...\u003C/a> is not clickable at point (508, 553). Other element would receive the click: \u003Cp>...\u003C/p>\n  (Session info: chrome=80.0.3987.116)","stacktrace":"Backtrace:\n\tOrdinal0 [0x003E0C83+1707139]\n\tOrdinal0 [0x003468F1+1075441]\n\tOrdinal0 [0x002BDFC9+516041]\n\tOrdinal0 [0x0025C029+114729]\n\tOrdinal0 [0x0025B260+111200]\n\tOrdinal0 [0x00259F5E+106334]\n\tOrdinal0 [0x00259770+104304]\n\tOrdinal0 [0x00253AD1+80593]\n\tOrdinal0 [0x00269E9D+171677]\n\tOrdinal0 [0x00253916+80150]\n\tOrdinal0 [0x0026A0E1+172257]\n\tOrdinal0 [0x002730F4+209140]\n\tOrdinal0 [0x00269D4B+171339]\n\tOrdinal0 [0x00251D4A+73034]\n\tOrdinal0 [0x00252DC0+77248]\n\tOrdinal0 [0x00252D59+77145]\n\tOrdinal0 [0x0035BB67+1162087]\n\tGetHandleVerifier [0x0047A966+508998]\n\tGetHandleVerifier [0x0047A6A4+508292]\n\tGetHandleVerifier [0x0048F7B7+594583]\n\tGetHandleVerifier [0x0047B1D6+511158]\n\tOrdinal0 [0x0035402C+1130540]\n\tOrdinal0 [0x0035D4CB+1168587]\n\tOrdinal0 [0x0035D633+1168947]\n\tOrdinal0 [0x00375B35+1268533]\n\tBaseThreadInitThunk [0x75986359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77737B74+228]\n\tRtlGetAppContainerNamedObjectPath [0x77737B44+180]\n"}}
_WD_ElementAction: {"value":{"error":"element click intercepted","message":"element click intercepted: Element \u003Ca ...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"element click intercepted","message":"element click intercepted: Element \u003Ca class=\"list-group-item list-group-item-info dropdown-header\" role=\"menuitem\" tabindex=\"-1\" href=\"\" ng-click=\"showDetail(dummy.crm)\" index=\"0\" scrolltopview=\"\" style=\"background: rgb(255, 255, 102); border-radius: 5px; padding-left: 3px;\">...\u003C/a> is not clickable at point (508, 553). Other element would receive the click: \u003Cp>...\u003C/p>\n  (Session info: chrome=80.0.3987.116)","stacktrace":"Backtrace:\n\tOrdinal0 [0x003E0C83+1707139]\n\tOrdinal0 [0x003468F1+1075441]\n\tOrdinal0 [0x002BDFC9+516041]\n\tOrdinal0 [0x0025C029+114729]\n\tOrdinal0 [0x0025B260+111200]\n\tOrdinal0 [0x00259F5E+106334]\n\tOrdinal0 [0x00259770+104304]\n\tOrdinal0 [0x00253AD1+80593]\n\tOrdinal0 [0x00269E9D+171677]\n\tOrdinal0 [0x00253916+80150]\n\tOrdinal0 [0x0026A0E1+172257]\n\tOrdinal0 [0x002730F4+209140]\n\tOrdinal0 [0x00269D4B+171339]\n\tOrdinal0 [0x00251D4A+73034]\n\tOrdinal0 [0x00252DC0+77248]\n\tOrdinal0 [0x00252D59+77145]\n\tOrdinal0 [0x0035BB67+1162087]\n\tGetHandleVerifier [0x0047A966+508998]\n\tGetHandleVerifier [0x0047A6A4+508292]\n\tGetHandleVerifier [0x0048F7B7+594583]\n\tGetHandleVerifier [0x0047B1D6+511158]\n\tOrdinal0 [0x0035402C+1130540]\n\tOrdinal0 [0x0035D4CB+1168587]\n\tOrdinal0 [0x0035D633+1168947]\n\tOrdinal0 [0x00375B35+1268533]\n\tBaseThreadInitThunk [0x75986359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77737B74+228]\n\tRtlGetAppContainerNamedObjectPath [0x77737B44+180]\n"}}


 

:rolleyes:

Link to comment
Share on other sites

From the W3C specs --

Quote
Error Code HTTP Status JSON Error Code Description
element click intercepted 400 element click intercepted The Element Click command could not be completed because the element receiving the events is obscuring the element that was requested clicked.

The latest UDF release contains some improvements _WD_ElementAction in handling this HTTP status as a response. This could be further expanding to return an different error code to better indicate why the click attempt failed.

Have you tried clicking the container element instead of the link? Not sure how to assist further with the limited info supplied.

Link to comment
Share on other sites

 

Your help has been invaluable.
my idea was also to get the x, y coordinates of the control and then simulate pressing the left mouse button. Is it possible to obtain the coordinates of a control ?

I have not tried to click the container element. I do tests in this sense.I have no experience in web programming / web automation. so it's all new and difficult for now.

:rolleyes:

Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...