Jump to content

How can I click on a class object in ie?


Recommended Posts

<DIV class=navbar-header><BUTTON class=navbar-toggle type=button data-target=".navbar-collapse" data-toggle="collapse">
<I style="COLOR: #fff" class="fa fa-bars"></I></BUTTON>

Trying to get IE to click on the above control but I cannot figure out the syntax.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

I don't like IE UDF, is too slow, learn about http and use winHTTP, is easy to use for simple tasks like this one.

check out this example:


Assuming you want to click the DIV you were searching for above (though most buttons are <inputs>)
 
#include <IE.au3>
$oIE = _IECreate ("http://www.test.com", 0, 0, 1, 0)
 
$oCorrectObj = ""
 
$tags = $oIE.document.GetElementsByTagName("div")
For $tag in $tags
$class_value = $tag.GetAttribute("class")
If string($class_value) = "levelBar" Then
$oCorrectObj = $tag
 
MsgBox(0, "Level: ", "Level found :)")
ExitLoop
 
EndIf
Next
 
If IsObj ( $oCorrectObj ) Then
 
_IEAction ($oCorrectObj, "click")
 
 
EndIF
 
 
_IEQuit ($oIE)
 
 
edit: just realized this is a super old post, but the same structure can be used for whatever your element is

 

if there's only a button with navbar-toggle class is straight forward

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Link to comment
Share on other sites

weird, I replaced everything thats needed, you just need to specify the actual url

#include <IE.au3>
$oIE = _IECreate ("http://www.test.com", 0, 0, 1, 0)
 
$oCorrectObj = ""
 
$tags = $oIE.document.GetElementsByTagName("BUTTON ")
For $tag in $tags
$class_value = $tag.GetAttribute("class")
If string($class_value) = "navbar-toggle" Then
$oCorrectObj = $tag
 
MsgBox(0, "Level: ", "Level found :)")
ExitLoop
 
EndIf
Next
 
If IsObj ( $oCorrectObj ) Then
 
_IEAction ($oCorrectObj, "click")
 
 
EndIF
 
 
_IEQuit ($oIE)

 

I dont mind using ff or chrome but the documentation is equally as perplexing to me.

yeah, I know, but once you learned the basics of http it will be very simple, use _WinHttpSimpleSendRequest() for submiting whatever that button does.

PS: In IE you can view the page, in winhttp you work only with code, you have to know what you want to do and how requests work.

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...