Jump to content
jmp

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

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>

 

Share this post


Link to post
Share on other sites
9 minutes ago, Nine said:

What have you tried ?

@Nine

I am trying to get table from ie but when i go to homepage i get popup box, i want to close it (make fully automatic) and continue my script.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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")

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
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>

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
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:

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By jmp
      I am trying to click on td items using this code :
      #include <IE.au3> #include <MsgBoxConstants.au3> $oIE = _IEAttach ("Webpage") $sMName = "Akshay Vora" Local $oTDs = _IETagNameGetCollection($oIE, "td")   For $oTD in $oTDs   If String($oTD.InnerText) = $sMName Then MsgBox(0, "", $sMName & @CRLF & $oTD.InnerText)       _IEAction($oTD, "click")       ExitLoop       EndIf   Next Working on other td items
      But, If $sMName = First TD It showing msgbox but not click on matched first td item.
    • By SugarBall
      Hello, can anyone give a help with getting this "special" ID below and click it:
      data-soccerid=".2.1:5:1:$post653711358129481_653714114795872:0.0.$there.0.$here.0.3.$HelpToggle:0"
      I have tried to get it with $a.innerHtml and click it with _IEAction.
      the script i wrote has no errors but seems it doesn't click my button either !
    • By SugarBall
      Hello, can anyone give a help with getting this "special" ID below and click it:
      data-siteid=".2.1:5:1:$post653711358129481_653714114795872:0.0.$up.0.$down.0.3.$voteToggle:0"
      I have tried to get it with $a.innerHtml and click it with _IEAction.
      the script i wrote has no errors but seems it doesn't click my button either !
    • By Athos
      Hi guys I'm trying to submit a form, but IEFormSubmit gives an error like so:


      Line585(IE.au3)
      WEnd
      WEnd^ ERROR


      Error: The requested action with this object has failed.


      So I take this to mean I can't use IEform submit,

      so I thought I could use IE action......

      problem is, I don't know how to click on the submit button by value.

      I checked the HTML and this is all I get is <input type="submit" value="Login">

      So yeah, I need to find a way to submit by value.

      Do I have to loop through all the values with IETagNameGetCollection? or is there an easier way?

      Thanks
×
×
  • Create New...