Jump to content

Recommended Posts

Posted

Hello everybody, this is my first request after spending the last night by trying to solve this problem. I really hope that somebody can help me with this. 
I try to click on a specific button to trigger an onclick event while using IE.au3,

Here is my code: 


Code1.PNG.3b34041beac641977e02720d9c906e1b.PNG

I also tryed out this version: 

Code2.thumb.PNG.6bdd7083c31a82fcd01d030a991e6fc1.PNG

But both doesn't work. 

Here is the sourcecode of the element want to click: 

Sourcecode

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thank's for your help I'm a bit dispairing with this. 

Posted

That will makes it a bit easier to read: 

Code1:

Local $oIE = _IECreate("https://www.tradingview.com/chart/CPimMRTr/#", 1)

_IELoadWait($oIE)

$oSubmitClick = _IEGetObjById($oIE,"tv-screener-toolbar__button tv-screener-toolbar__button--space_right tv-screener-toolbar__button--export apply-common-tooltip-fixed")
_IEAction($oSubmitClick, "click")
_IELoadWait($oIE,2000)

 

Code2: 

Local $oButs = _IETagNameGetCollection($oIE, "button")
For $oBut In $oButs
    If StringInStr($oBut.classname, "tv-screener-toolbar__button tv-screener-toolbar__button--space_right tv-screener-toolbar__button--export apply-common-tooltip-fixed") Then _IEAction($oBut, "click")
Next

 

Sourcecode: 
 

<div tabindex="0" class="tv-screener-interval-select tv-dropdown tv-dropdown-behavior"><div class="tv-screener-toolbar__button tv-screener-toolbar__button--space_right tv-screener-toolbar__button--export apply-common-tooltip common-tooltip-fixed"><svg xmlns="http://www.w3.org/2000/svg" class="tv-screener-toolbar__button-icon tv-screener-toolbar__button-icon--export" viewBox="0 0 16 14" width="16" height="14"><g fill="none" stroke="#758696" stroke-width="1.5"><path d="M 15 9 v 4 H 1 V 9 M 8 9 V 0" /><path d="M 5 6 l 3 3 l 3 -3" /></g></svg></div>

If someone need to copy parts of the code. Sorry for the circumstances. 

Posted

Code1 won't work because you can't use an element's class to find it with _IEGetObjById. Code2 won't work because you are gathering button elements, when the desired element is actually a Div. Try searching for a matching Div instead --

Local $oDivs = _IETagNameGetCollection($oIE, "div")
For $oDiv In $oDivs
    If StringInStr($oDiv.classname, "tv-screener-toolbar__button tv-screener-toolbar__button--space_right tv-screener-toolbar__button--export apply-common-tooltip-fixed") Then _IEAction($oDiv, "click")
Next

 

Posted

Hello Danp2, 

thank you so much, you can't imagin how many hours I spend last night for this. 

Here is the working code: 

 

Local $oDivs = _IETagNameGetCollection($oIE, "div")
For $oDiv In $oDivs
    If StringInStr($oDiv.classname, "tv-screener-toolbar__button tv-screener-toolbar__button--space_right tv-screener-toolbar__button--export apply-common-tooltip common-tooltip-fixed") Then _IEAction($oDiv, "click")
Next

Note the div was a bit different. 

I hope it supports someone who has the same request.

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