Jump to content

how can i click the tab in a web page using auto it


Recommended Posts

I inspect that Security tab in the webpage .I get the html element below:

<td tabindex="-1" align="center" class="infaTabsetSimpleTabSetTop" nowrap="true" valign="middle" onfocus="app_details_browse.$47()">Security</td>

If iam using the class name and trying to click the element. Iam getting "found" but cannot click as all the tab contains same class.

If iam using the onfocus attribute which is different for every tab and trying to click the element, the element cannot be found.

Local $oFound = ""
Local $oBtns = _IETagNameGetCollection($oIE, "td")

For $oBtn In $oBtns
    ;If String($oBtn.onfocus) ="app_details_browse.$47()" Then
    If String($oBtn.classname) = "infaTabsetSimpleTabSetTop" Then
     $oFound = $oBtn
   EndIf
Next

If IsObj($oFound) Then
    _IEAction ($oFound, "focus")
    _IEAction ($oFound, "click")
    MsgBox(16, "Success", "found")
Else
    MsgBox(16, "Failed", "Not found.")
EndIf

infaauto.png

Link to comment
Share on other sites

Added the _IEPropertyGet and got the innertext as "Security" in the message box. So im pointing the right object but it is not clicking the tab.

Local $iScreenX = _IEPropertyGet($oFound, "innertext")
 MsgBox(0,"",$iScreenX)
If IsObj($oFound) Then
    _IEAction ($oFound, "click")
    MsgBox(16, "Success", "found")

Trying with the below code .. it is going into the if statement and displaying the msgbox as clicked but it is not clicking.

If String($oFound.innertext) = "Security" Then
_IEAction ($oFound, "click")
MsgBox(16, "Success", "Clicked")
EndIF
Edited by Mercy
Link to comment
Share on other sites

6 hours ago, Mercy said:

Trying with the below code .. it is going into the if statement and displaying the msgbox as clicked but it is not clicking.

It's difficult to give additional suggestions when the only thing you've shown us is a screen shot. Have you logged into the site prior to running your code?

 

Link to comment
Share on other sites

Can you try the following looking at the actions of the td it only has an OnFocus action, nothing for OnClick, unless they have some other code which is being fired based upon the OnFocus and the Class Name.  Hope that makes sense.

If $oFound.innertext = "Security" Then
    _IEAction ($oFound, "focus")
    MsgBox(16, "Success", "Clicked")
EndIF

 

Link to comment
Share on other sites

8 hours ago, Subz said:

Can you try the following looking at the actions of the td it only has an OnFocus action, nothing for OnClick, unless they have some other code which is being fired based upon the OnFocus and the Class Name.  Hope that makes sense.

If $oFound.innertext = "Security" Then
    _IEAction ($oFound, "focus")
    MsgBox(16, "Success", "Clicked")
EndIF

 

Yes, tried with this also. the web page is not loading to the page which security tab has to load.

And when we do manually, we need to click that tab and not to focus.

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