AutoPM Posted March 21, 2018 Share Posted March 21, 2018 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> Link to comment Share on other sites More sharing options...
Zedna Posted March 21, 2018 Share Posted March 21, 2018 (edited) Look here https://www.autoitscript.com/forum/topic/192780-how-to-do-click-selection-using-autoit/ EDIT: topic is only viewable through google archive (I don't know why?) here: https://webcache.googleusercontent.com/search?q=cache:bvq_IVz_JaYJ:https://www.autoitscript.com/forum/topic/192780-how-to-do-click-selection-using-autoit/+&cd=1&hl=cs&ct=clnk&gl=cz Edited March 21, 2018 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AutoPM Posted March 21, 2018 Author Share Posted March 21, 2018 For Both Links I'm getting This Message: We could not locate the item you are trying to view. Link to comment Share on other sites More sharing options...
Zedna Posted March 21, 2018 Share Posted March 21, 2018 (edited) I can see topic and reply with no problems Here is copy/paste of image+code from there for you: #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 March 21, 2018 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AutoPM Posted March 21, 2018 Author Share Posted March 21, 2018 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 More sharing options...
Danp2 Posted March 21, 2018 Share Posted March 21, 2018 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 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AutoPM Posted March 21, 2018 Author Share Posted March 21, 2018 #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 More sharing options...
Danp2 Posted March 21, 2018 Share Posted March 21, 2018 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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AutoPM Posted March 21, 2018 Author Share Posted March 21, 2018 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now