Jump to content

I want to search for contains in _WD_FindElement.


Recommended Posts

<body>
    <div class="contents_section">
    <form name="reser_area" id="reser_area" method="post" >
        <div class="reserve_type_area">
            <p style="text-align:right;padding-top:7px;">
                <img src="./btn_inwon_select.png" onclick="javascript:keyPerson('Y','1')" >
            </p>
        </div>
    </form>
    </div>
    </body>
$SetScript = '//img[contains(@src,"btn_inwon_select.png"]'
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $SetScript)
_WD_ElementAction($sSession, $sElement, 'click')

 

This will give you an error. What should I do?

 

[1612662790.471][INFO]: Waiting for pending navigations...
[1612662790.472][INFO]: Done waiting for pending navigations. Status: ok
[1612662790.475][INFO]: Waiting for pending navigations...
[1612662790.475][INFO]: Done waiting for pending navigations. Status: ok
[1612662790.475][INFO]: [1c73a8c6eec7bb900ca21ea1e9ce8410] RESPONSE ExecuteScript "complete"
[1612662790.493][INFO]: [1c73a8c6eec7bb900ca21ea1e9ce8410] COMMAND FindElement {
   "using": "xpath",
   "value": "//p//img[contains(@src,\"btn_inwon_select.png\"]"
}
[1612662790.494][INFO]: Waiting for pending navigations...
[1612662790.494][INFO]: Done waiting for pending navigations. Status: ok
[1612662790.512][INFO]: Waiting for pending navigations...
[1612662790.512][INFO]: Done waiting for pending navigations. Status: ok
[1612662790.512][INFO]: [1c73a8c6eec7bb900ca21ea1e9ce8410] RESPONSE FindElement ERROR invalid selector: Unable to locate an element with the xpath expression //p//img[contains(@src,"btn_inwon_select.png"] because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//p//img[contains(@src,"btn_inwon_select.png"]' is not a valid XPath expression.
  (Session info: chrome=88.0.4324.150)
[1612662790.524][INFO]: [1c73a8c6eec7bb900ca21ea1e9ce8410] COMMAND Quit {

}

 

Link to post
Share on other sites
  • Moderators

You appear to be missing a curly brace at the end of .ping" to close the "contains".

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...