JAG1117 Posted May 30, 2017 Share Posted May 30, 2017 I've been trying to click this div and I've tried every way that I can think of and it will not expand. Will someone please point me in the right direction. Here is the code for the div and a screenshot of what it looks like. expandcollapse popup<div id="section" checkfeature="PUSH"> <p class="section"> <img src="images/icon_plus.gif"> <strong> <span textid="196">Push</span> </strong> </p> <div style="display: none;"> <table> <tbody><tr> <td> <span textid="3">Allow Push Messages</span> </td> <td> <select name="7" helpid="272" isrebootrequired="false" paramname="apps.push.messageType" default="0" web="5" variabletype="integer" min="0" max="5" style="visibility: visible;"> <option value="5" textid="795" selected="selected">All</option> <option value="4" textid="796">Critical</option> <option value="3" textid="766">High</option> <option value="2" textid="797">Important</option> <option value="1" textid="747">Normal</option> <option value="0" textid="750">None</option> </select> </td> </tr> <tr> <td> <span textid="7">Application Server Root URL</span> </td> <td> <input name="12" isrebootrequired="false" helpid="273" value="" paramname="apps.push.serverRootURL" default="" variabletype="string" min="0" max="256" maxlength="256"> </td> </tr> <tr> <td> <span textid="274">User Name</span> </td> <td> <input name="13" isrebootrequired="false" helpid="274" value="Push" paramname="apps.push.username" default="" web="Push" variabletype="string" min="0" max="49" maxlength="49"> </td> </tr> <tr> <td> <span textid="175">Password</span> </td> <td> <input type="password" name="8" isrebootrequired="false" helpid="275" value="????" paramname="apps.push.password" default="" web="????" variabletype="string" min="0" max="49" maxlength="49"> </td> </tr> </tbody></table> </div> </div> Link to comment Share on other sites More sharing options...
Subz Posted May 31, 2017 Share Posted May 31, 2017 In the script below you'll need to use either _IECreate or _IEAttach to connect to the url, hopefully this should expand the "Push" div. #include <IE.au3> Local $oIE = _IECreate("Filename.html", 1) _IELoadWait($oIE) Local $oDivs = _IETagNameGetCollection($oIE, "div") For $oDiv In $oDivs If $oDiv.GetAttribute("checkfeature") = "Push" Then _IEAction($oDiv, "click") Next Link to comment Share on other sites More sharing options...
JAG1117 Posted May 31, 2017 Author Share Posted May 31, 2017 Alright, I tried that code and it didn't work. I also tried to narrow it down some and that didn't work either. For $oDiv In $oDivs If $oDiv.GetAttribute("id") = "section" And $oDiv.GetAttribute("checkfeature") = "PUSH" Then _IEAction($oDiv, "click") Link to comment Share on other sites More sharing options...
Danp2 Posted May 31, 2017 Share Posted May 31, 2017 "didn't work" isn't the type of feedback you should supply if you want help. At a minimum, post the results from the Scite output window. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
JAG1117 Posted May 31, 2017 Author Share Posted May 31, 2017 Didn't know that existed, let me see if I can find it. Link to comment Share on other sites More sharing options...
JAG1117 Posted May 31, 2017 Author Share Posted May 31, 2017 (edited) This is the code I ran: #include <IE.au3> Call ("signIn") Func signIn () Global $oIE = _IECreate ("http://10.21.1.20") Local $password = _IEGetObjByName ($oIE, "password") _IEFormElementSetValue ($password, "456") $oLinks = _IETagNameGetCollection($oIE, "input") For $oLink In $oLinks If String($oLink.type) = "submit" And String($oLink.value) = "Submit" Then _IEAction($oLink, "click") ExitLoop EndIf Next _IELoadWait($oIE, 5000) $oBtn = _IEGetObjById($oIE, "topMenuItem4") _IEAction($oBtn, "click") _IELoadWait($oIE, 2000) _IELinkClickByText($oIE, "Applications") _IELoadWait($oIE, 8000) Local $oDivs = _IETagNameGetCollection($oIE, "div") For $oDiv In $oDivs If $oDiv.GetAttribute("checkfeature") = "PUSH" Then _IEAction($oDiv, "click") EndIf Next EndFunc And this is the output: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\administrator\Desktop\test.au3" >Exit code: 0 Time: 16.43 Edited May 31, 2017 by JAG1117 Link to comment Share on other sites More sharing options...
Danp2 Posted May 31, 2017 Share Posted May 31, 2017 That output indicates that these two lines are failing Local $password = _IEGetObjByName ($oIE, "password") _IEFormElementSetValue ($password, "456") Other than that, have you tried _IEFormSubmit instead of looping through the links? You could also add a ConsoleWrite to the code so that you can detect if the Div is being found. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
JAG1117 Posted May 31, 2017 Author Share Posted May 31, 2017 Sorry, I was already logged into the webpage when I posted that and didn't realize, those errors aren't there when I logged out. I updated my other post with the right output. Link to comment Share on other sites More sharing options...
JAG1117 Posted May 31, 2017 Author Share Posted May 31, 2017 Alright, I got it to work: For $oDiv In $oDivs If $oDiv.GetAttribute("textid") = "196" Then _IEAction($oDiv, "click") EndIf Next Link to comment Share on other sites More sharing options...
Danp2 Posted May 31, 2017 Share Posted May 31, 2017 Is that the only change you made? I ask this because that textid belongs to a span, not a div. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
JAG1117 Posted June 1, 2017 Author Share Posted June 1, 2017 You're right sorry: Local $oDivs = _IETagNameGetCollection($oIE, "span") For $oDiv In $oDivs If $oDiv.GetAttribute("textid") = "196" Then _IEAction($oDiv, "click") 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