Jump to content

Recommended Posts

Posted
<div class="lmt__language_select__menu" dl-test="translator-source-lang-list" style="left: 87px;">
    <button dl-value="auto" tabindex="100">Qualsiasi lingua (rileva)</button>
    <button dl-value="IT" tabindex="100">Italiano</button>
    <button dl-value="EN" tabindex="100">Inglese</button>
    <button dl-value="DE" tabindex="100">Tedesco</button>
    <button dl-value="FR" tabindex="100">Francese</button>
    <button dl-value="ES" tabindex="100">Spagnolo</button>
    <button dl-value="PT" tabindex="100">Portoghese</button>
    <button dl-value="NL" tabindex="100">Olandese</button>
    <button dl-value="PL" tabindex="100">Polacco</button>
    <button dl-value="RU" tabindex="100">Russo</button>
</div>

 

Hello!

I would like to use IE to click a button in the div.

I need to get the object of the div by 'dl-test' attribute and then the object of the button by 'dl-value'.

Is there a function to do this?

I tried the following, but it isn't working :(

 

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, 'https://www.deepl.com/it/translator#es/it', 1)

Local $oInputs = _IETagNameGetCollection($oIE, "button")
Local $sTxt = ""
For $oInput In $oInputs
    $sTxt &= $oInput.type & - $oInput.GetAttribute("dl-value") &@CRLF
Next
MsgBox(0, "", "Form: " & $oInput.form.name & @CRLF & @CRLF & "         Types :" & @CRLF & $sTxt)

 

Posted
19 hours ago, Jfish said:

I see a message box with all the types when I run it ... 

If I want to click on the button "Spagnolo" for example, I need to get the button which has 'dl-value=ES', so I need a way to get the 'dl-value' value. 

Posted

This works well :

#include <IE.au3>

Opt ("MustDeclareVars", 1)

Global $oIE = _IECreate ("https://www.deepl.com/it/translator#es/it")

Local $Text
Local $oInputs = _IETagNameGetCollection($oIE, "button")
For $oInput In $oInputs
  If $oInput.GetAttribute("dl-value") = "ES" Then
    $Text = $oInput.innerText
    $oInput.click ()
    ExitLoop
  EndIf
Next

MsgBox ($MB_SYSTEMMODAL,"",$Text)

 

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