Jump to content

webdriver - more than one submit


ademon
 Share

Recommended Posts

Hi. I can not automate the click at a button, because there are three of them exactly in the source page.

Imagine you have this html source code:

<div class="submit"><span class="button btnDefault"><span><input type="submit" value="Search" /></span></span></div>

How could I select just one element, and do click as an action on it?

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']")

_WD_ElementAction($sSession, $sElement, 'click')

That just do not work.

Any ideas?

submits.PNG

Link to comment
Share on other sites

You can get an array of submit elements then access to correct one in the array.

 

Saludos

Link to comment
Share on other sites

31 minutes ago, Danyfirex said:

You can get an array of submit elements then access to correct one in the array.

 

Saludos

Gracias Danyfirex, I think I understand what you mean but I do not know how to code it

I have tried to do this:

Local $aVar[3]
    _ArrayAdd ($aVar,_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']"))
    _ArrayAdd ($aVar,_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']"))
    _ArrayAdd ($aVar,_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']"))

    MsgBox($MB_SYSTEMMODAL, "FINaaa", $aVar[2] )
    _WD_ElementAction($sSession, $aVar[2], 'click')

but with out result.

Link to comment
Share on other sites

I meant this:

Local $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']","",True)
_ArrayDisplay($aElements)

Saludos

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

×
×
  • Create New...