Jump to content

Recommended Posts

Posted

Hello,

Im trying to click the "Solution Downloads" link that gets populated by javascript. I've tried several things and looked at several posts related to this topic but have not been able to find a solution. I wish I could post the link but it would require the use to login to get to this step. 

Here is some of the HTML:

Downloads</h3><br/>
         <div>
            <span style="font-weight:400;font-size:14px">Keep your solutions up to date and access your latest software downloads all in one place</span>
            <br/><br/>
            <a href="javascript:FlexeraRedirect()"><div class="rn_SecondaryButton" style="float:left">Solution Downloads</div></a>
            </div>
        </div>

Here is what I have tried:

_IELinkClickByText($oIE, "Solution Downloads")
Local $divs = _IETagNameGetCollection($oIE, "div")
   For $div in $divs
    If $div.ClassName = "rn_SecondaryButton" Then
        _IEAction($div,"click")
endif

Next
$oIE.document.parentwindow.execscript("FlexeraRedirect()","javascript")

This returned "'FlexeraRedirect' is undefined."

I also tried _IELinkGetCollection.

Any ideas on how to approach this would be greatly appreciated.

Posted

Hello and welcome!

It looks like you're on the right track. I imagine that your first method (_IELinkClickByText) won't work because the link actually has no text, the div contains the text. Your second method comes closest, I think, but you actually want to click on the parent of that div, as the div has no event fired on click, the link itself does. I honestly have no idea about your third method, that's something I've never tried.

So to fix it, I would try something like this: (untested)

Local $divs = _IETagNameGetCollection($oIE, "div")
; If there is an error, display it in the console
If @error Then ConsoleWrite("! _IETagNameGetCollection Error: " & @error)
For $div in $divs
    If $div.ClassName = "rn_SecondaryButton" Then
        ; Click on the parent element, should be a link
        _IEAction($div.parentElement,"click")
        ; If there is an error
        If @error Then
            ; Print the error
            ConsoleWrite("! _IEAction Error: " & @error)
        Else
            ; Got the correct div, stop testing them
            ExitLoop
        EndIf
    EndIf
Next

 

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Posted

Thank you both for your responses!

I tried both of your solutions, but still wasn't able to get to the next page.

However (I feel kind of stupid), I copied the link from the page that I need to go to and and used _IENavigate. It worked!

_IENavigate ($oIE,"mylink")

Not sure if this is best practice, but it works for what I need for now.

Thanks again,

Kyle

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