JAG1117

Expanding a Div to populate form.

11 posts in this topic

#1 ·  Posted

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.

 

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

 

phones.png

Share this post


Link to post
Share on other sites



#2 ·  Posted

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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

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")

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

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

Share this post


Link to post
Share on other sites

#5 ·  Posted

Didn't know that existed, let me see if I can find it.

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by JAG1117

Share this post


Link to post
Share on other sites

#7 ·  Posted

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.

Share this post


Link to post
Share on other sites

#8 ·  Posted

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.

Share this post


Link to post
Share on other sites

#9 ·  Posted

Alright, I got it to work:

For $oDiv In $oDivs
          If $oDiv.GetAttribute("textid") = "196" Then
             _IEAction($oDiv, "click")


         EndIf
         Next

 

Share this post


Link to post
Share on other sites

#10 ·  Posted

Is that the only change you made? I ask this because that textid belongs to a span, not a div.

Share this post


Link to post
Share on other sites

#11 ·  Posted

You're right sorry:

Local $oDivs = _IETagNameGetCollection($oIE, "span")
               For $oDiv In $oDivs
                   If $oDiv.GetAttribute("textid") = "196" Then
                      _IEAction($oDiv, "click")

 

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