Jump to content

IE click <span> based on title or value


DaLiMan
 Share

Recommended Posts

 

Hi, I'm trying to figure out how to click on the <span> highlighted in the picture.
I thought I needed to get the <DIV> and then get al the <td> but this is not working.

The value of the title are created by the website based on a given value in a searchbox.
Therefore I need to check if the value of the span is the right one and then click it if so.

Both give back an object, but i'm not getting any good results.

Any ideas?

Local $oSearch = _IEGetObjById($oIE, 'form3_ProductHierarchy_SELECTOR')
ConsoleWrite("$oSearch IsObj : " & IsObj($oSearch) & @CRLF)

Local $oTable = _IETagNameGetCollection($oSearch, "td")
ConsoleWrite("$oTable IsObj : " & IsObj($oSearch) & @CRLF)

For $oTD in $oTable
    ConsoleWrite("$oTD: " & $oTD.value & @CRLF)
Next

 

OLimage.jpg

Link to comment
Share on other sites

@FrancescoDiMuro Sometimes it's just that simple.... Thanks for setting me back on track.

@Danp2 No, it's an environment at work.

 

I didn't realize span could be collected too. Now the code is looking like this.
The hard coded value's are ultimately to be $variables. 

 

Local $oSearch = _IEGetObjById($oIE, 'form3_ProductHierarchy_SELECTOR')
ConsoleWrite("$oSearch IsObj : " & IsObj($oSearch) & @CRLF)

Local $oTable = _IETagNameGetCollection($oSearch, "span")
ConsoleWrite("$oTable IsObj : " & IsObj($oSearch) & @CRLF)

For $oTD in $oTable
    ConsoleWrite("$oTD: " & $oTD.title & @CRLF)
    If StringInStr($oTD.title,"254701") > 0 Then
        _IEAction($oTD, "focus")
        _IEAction($oTD, "click")
        ExitLoop
    EndIf
Next

 

Thank you both.

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...