Jump to content

How to click on IE button based on title or class ?


jmp
 Share

Recommended Posts

How can i click on (Pop Up) button that was based on title or class ?

<button title="close" class="close" type="button" data-dismiss="modal">×</button>
<button class="btn btn-default" type="button" data-dismiss="modal">Close</button>

 

Link to comment
Share on other sites

  • Developers

The question is NOT "what you are trying to accomplish"  but rather "What have you tried yourself that is not working?"
In other words: Stop dumping requests for getting others to code for you and show your efforts first!
(pretty sure this is not the first time this is said to you...right?)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

38 minutes ago, Jos said:

The question is NOT "what you are trying to accomplish"  but rather "What have you tried yourself that is not working?"
In other words: Stop dumping requests for getting others to code for you and show your efforts first!
(pretty sure this is not the first time this is said to you...right?)

Jos

@Jos @Nine

I am tried with this code :

<button class="btn btn-default" type="button" data-dismiss="modal">Close</button>
#include <IE.au3>
$oIE = _IEAttach ("Edu")
clickobjbyclass($oIE, 'btn btn-default')
Func clickobjbyclass(ByRef $oIE, $class)
    $tags = $oIE.document.GetElementsByTagName('button')
    For $tag In $tags
        $class = $tag.GetAttribute('class')
        If String($class) = $class Then
            Return _IEAction($tag, 'click')
        EndIf
    Next
    Return False
EndFunc
#include <IE.au3>
$oIE = _IEAttach ("Edu")
_IELinkClickByText($oIE, "Close")

 

Link to comment
Share on other sites

  • Developers

Great, but don't think your posted script is runnable for us and replicating your issue, so how are we supposed to assist you when we can't see the Webpage source? 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

8 minutes ago, Jos said:

Great, but don't think your posted script is runnable for us and replicating your issue, so how are we supposed to assist you when we can't see the Webpage source? 

This webpage need my username and password, without username and password it can't be accessed.

Link to comment
Share on other sites

  • Developers

So the question remains how we are supposed to help you when we do not know the HTML source for that page?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

22 minutes ago, Jos said:

So the question remains how we are supposed to help you when we do not know the HTML source for that page?

<button class="btn btn-default" type="button" data-dismiss="modal">Close</button>
<button title="close" class="close" type="button" data-dismiss="modal">×</button>

 

Link to comment
Share on other sites

  • Developers

Déjà vu
Honestly can't be bothered anymore with your questions when you aren't willing to provide a proper reproducer. 
Maybe other are willing to keep on stabbing in the dark. 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

18 hours ago, Danp2 said:

@jmp The code for clickobjbyclass (which I'm guessing you copied from elsewhere on the forum) has a flaw in it where the class parameter is being overwritten. There are other working examples on the forum if you search for them.

@Danp2

i am tried also with this code :

#include <IE.au3>
$oIE = _IEAttach ("Edu")
Local $iCloses = _IETagNameGetCollection($oIE, "button")
For $iClose In $iCloses
    If String($iClose.innertext) = "Close" Then
       MsgBox(0, "", "Found")
       _IEAction($iClose, "click")
      EndIf
Next

I am get msgbox but not click on Close button.

Link to comment
Share on other sites

As @Jos stated, you can't expect us to debug your code for you when you don't provide enough details (ie: page's full HTML source).

Either you are clicking the wrong button (did you check to see if there are frames associated with the popup?) or the click isn't triggering the underlying javascript event(s). Either way, only way to solve the problem is for you to do some actual investigating / debugging on your end. :rolleyes:

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