Jump to content

How to click button like


MJ36
 Share

Recommended Posts

image.thumb.png.a3ca4ddd5775365af67ff444c6886bd3.png

How to click this button ? 

I Try 

 

func test ()
    $oCorrectObj = ""

$tags = $oIE.document.GetElementsByTagName("button")
For $tag in $tags
$class_value = $tag.GetAttribute("type")
If string($class_value) = "buttont" Then
    $oCorrectObj = $tag

MsgBox(0, "Level: ", "Level found :)")

Else
    MsgBox(16, "Failed", "Not found.")

    ExitLoop

EndIf
Next

If IsObj ( $oCorrectObj ) Then

_IEAction ($oCorrectObj, "click")


EndIF

 

and

 

func klik ()

    Local $oFound = ""
Local $oBtns = _IETagNameGetCollection($oIE, "span")
For $oBtn In $oBtns
    If String($oBtn.classname) = "yt-uix-button-content" Then
        $oFound = $oBtn
        EndIf
Next

_IEAction ($oFound, "click")




EndFunc

 

Please Help 

Can you click it by name?

Link to comment
Share on other sites

If would change your _IETagNameGetCollection line to --

Local $oBtns = _IETagNameGetCollection($oIE, "button")

You would then need to loop through the collection to find the correct button.

Even better, you could limit the results by passing the containing div element instead of $oIE --

Local $oDiv = _IEGetObjById($oIE, "watch7-views-info")
Local $oBtns = _IETagNameGetCollection($oDiv, "button")

If there only one button or you know the index, you could do something like this --

Local $oDiv = _IEGetObjById($oIE, "watch7-views-info")
Local $oBtn = _IETagNameGetCollection($oDiv, "button", 0)
_IEAction ($oBtn, "click")

 

Link to comment
Share on other sites

it makes sense, it starts to brighten up :)
what if I have a few buttons there

 

image.png.3662fecb530c2adadd9a0a0a64e0bf98.png

 

Additional question
possibly if I can find a button by name in some way. Such knowledge would be useful in the future :) For example, I mean identification after this

image.png.0b85d30a7a4487d37e029d4d7602df76.png

 

 

 

 

Edited by MJ36
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...