Jump to content

Expanding a Div to populate form.


Recommended Posts

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

Link to comment
Share on other sites

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

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

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
Link to comment
Share on other sites

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.

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