Jump to content
AutoPM

Click a button with No ID or name

Recommended Posts

AutoPM

 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

Share this post


Link to post
Share on other sites
Zedna
AutoPM

For Both Links I'm getting This Message:

We could not locate the item you are trying to view.

Share this post


Link to post
Share on other sites
Zedna

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

Share this post


Link to post
Share on other sites
AutoPM

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

 

Share this post


Link to post
Share on other sites
Danp2

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

 

Share this post


Link to post
Share on other sites
AutoPM
#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

Share this post


Link to post
Share on other sites
Danp2
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.

Share this post


Link to post
Share on other sites
AutoPM

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.

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.