Jump to content

Click a button with No ID or name


Recommended Posts

 I'm

 making a Script For Printing Reports From An Online Portal.

I'm Unable To Click On This Button With Source Code:

<p class="title" id="padd">COURSES REGISTERED </p>

<div class="row"><div class="col s12 m6 l4 course-data">

  <div class="card choice center indigo darken-1 ">
  <div class="card-content white-text">
  <span class="card-title">JAVA</span>
  </div>
  <div class="card-action">
  <a class=" blue-text text-lighten-4">Level 1: <span class="white-text">66%</span></a>
  <a class=" blue-text text-lighten-4">Level 2: <span class="white-text">0%</span></a>
  <a class=" blue-text text-lighten-4">Level 3: <span class="white-text">0%</span></a>
  </div>
  </div>
Please Help

</div></div> </div>

 

 

 

Screenshot (187).png

Link to comment
Share on other sites

I can see topic and reply with no problems

Here is copy/paste of image+code from there for you:

image.png.4a6b4df1c684695e70612aa1bfab9d5d.png

#include <IE.au3>
Local $oButtons
Local $oIE = _IECreate("https://shopee.com.my/", 1)
Sleep(5000)
Local $oDivs = _IETagNameGetCollection($oIE, "div")
For $oDiv In $oDivs
    If $oDiv.ClassName = "language-selection__list" Then
        $oButtons = _IETagNameGetCollection($oDiv, "button")
        For $oButton In $oButtons
            If $oButton.InnerText = "English" Then _IEAction($oButton, "click")
        Next
    EndIf
Next

 

Edited by Zedna
Link to comment
Share on other sites

Thankyou For The Reply, But In My Case There Is No Button Tags Given Inside <div>...</div>. And It's Not Working.

#RequireAdmin
#include<IE.au3>

Global $oIE= _IECreate("http://care.srmuniv.ac.in/ktrcsejava2/")



Local $username= _IEGetObjByName($oIE,"username")
Local $password= _IEGetObjByName($oIE,"password")
Local $button= _IEGetObjById($oIE,"button")


_IEFormElementSetValue($username,"RA1611003010638")
_IEFormElementSetValue($password,"12345678")
sleep(200)
_IEAction($button,"click")

Local $oButtons

Sleep(1000)
Local $oDivs = _IETagNameGetCollection($oIE, "div")
For $oDiv In $oDivs
    If $oDiv.ClassName = "col s12 m6 l4 course-data" Then
        $oButtons = _IETagNameGetCollection($oDiv, "div")
        For $oButton In $oButtons
            If $oButton.InnerText = "JAVA" Then _IEAction($oButton, "click")
        Next
    EndIf
Next

 

Link to comment
Share on other sites

You'll need to modify the code to work with your site. For example --

#include<IE.au3>

Global $oIE= _IECreate("http://care.srmuniv.ac.in/ktrcsejava2/")

Local $username= _IEGetObjByName($oIE,"username")
Local $password= _IEGetObjByName($oIE,"password")
Local $button= _IEGetObjById($oIE,"button")


_IEFormElementSetValue($username,"RA1611003010638")
_IEFormElementSetValue($password,"12345678")
sleep(200)
_IEAction($button,"click")

Local $oButtons

Sleep(1000)
Local $oSpans = _IETagNameGetCollection($oIE, "span")
For $oSpan In $oSpans
    If $oSpan.innerText = "JAVA" Then
        _IEAction($oSpan, 'click')
        ExitLoop
    EndIf
Next

 

Link to comment
Share on other sites

#include<IE.au3>

Global $oIE= _IECreate("http://care.srmuniv.ac.in/ktrcsejava2/")

Local $username= _IEGetObjByName($oIE,"username")
Local $password= _IEGetObjByName($oIE,"password")
Local $button= _IEGetObjById($oIE,"button")


_IEFormElementSetValue($username,"RA1611003010638")
_IEFormElementSetValue($password,"12345678")
sleep(200)
_IEAction($button,"click")

Local $oButtons

Sleep(1000)
Local $oSpans = _IETagNameGetCollection($oIE, "span")
For $oSpan In $oSpans
    If $oSpan.innerText = "JAVA" Then
        _IEAction($oSpan, 'click')
        ExitLoop
    EndIf
Next

Still Not Clicking That Blue box

Link to comment
Share on other sites

50 minutes ago, AutoPM said:

Still Not Clicking That Blue box

Telling us something doesn't work without providing any additional details isn't going to get you the help that you're requesting. :>

FWIW, this code ran correctly and clicked the designated span element, taking me to another webpage with a circle of questions. Therefore, the problem is on your end and you need to figure out why it isn't working for you.

First step would be to add one or more ConsoleWrite statement so that you can see what elements are being processed.

Link to comment
Share on other sites

Thank you So Much Danp2 & Zedna.

Script Was Not Clicking That Box  For Me Before, Due To  "NEt BALANCer" App. After Closing It & Resetting all Settings In Internet Explorer.

Now Its Working Fine.

Thank you Again.

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