Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Click a button on a website

$
0
0

Hello, I am trying to automate some stuff we often have to do on a website. So far I can change the radiobutton to systemadmin enter the password and login. But then I need to click a button on the next page. I can do it by import-module WASP, but thats not very nice.

Here is what i have:

$IE = New-Object -com internetexplorer.application
$IE.visible = $true
$IE.navigate("Local Website")

do{sleep 5} While ($IE.busy)

$doc = $IE.document
$myradio = $doc.getElementsByTagName('Input') | ? {$_.type -eq 'radio' -and $_.name -eq 'usergroup'}
$x = 1
$myradio[$x].SetActive()
$myradio[$x].click()

$IE.Document.getElementById('txtAdminPass').value="Password"
$IE.Document.getElementById('Label1').click()

do{sleep 5} While ($IE.busy)

 

The following is the html where i got the needed info for the above things:

<div class="loginBodyRadioLayout">                   
                                        <input name="UserGroup" id="rdoAdmin" onclick="BLOCKED SCRIPTRadioButtonClick();" type="radio" value="rdoAdmin">
                                        <label id="lblAdminTitle" for="rdoAdmin">
                                            System Administrator
                                        </label>
                </div>

 

<td>
                                        <input name="txtAdminPass" disabled="" class="loginText_read_greyout" id="txtAdminPass" type="password" maxlength="64">
                        </td>

 

<div class="loginLabel">
                          <span class="loginbtn" id="Label1">Login</span>
                       </div>

 

On this next page i need to press a button to get where i want, and this is the html code of that button:

<tr>
                                <td width="230" height="72" class="nowrap" id="ctl08_ViewbtnAuthenticationManager" valign="top" onclick="__doPostBack('ctl08$btnAuthenticationManager','')">
                            <div class="btnbase" id="ctl08_btnBase1">
                                        <img class="trans" id="ctl08_imgAuthBtn1" style="border-width: 0px;" alt=" " src="Images/TopMenu_b_Authentication.png">
                                <table class="btnposition0">
                                    <tbody><tr>
                                        <td width="160" height="70">
                                                    <a class="maintxt" id="ctl08_btnAuthenticationManager" href="BLOCKED SCRIPT__doPostBack('ctl08$btnAuthenticationManager','')">Authentication<br>Manager</a>
                                        </td>
                                    </tr>
                                </tbody></table>
                            </div>
                        </td>
   
                    </tr>

 

I have tried many combinations to press the button, i tried using the methods i used to login. But none worked, Could someone maybe explain on how this can be achieved?

 

Thanks


Viewing all articles
Browse latest Browse all 6937

Trending Articles