Jump to content

Help clicking text link


Recommended Posts

Hi everyone. I've been researching and studying Autoit for the past week, and am creating a custom script. I've hit a wall, and while it seems like it should be easy, I'm unable to click a link searching strictly for the text, or even the "title" from the HTML piece.

Please help :(

Here’s the HTML code:

Is it possible to click by “Title”, or even the href piece “components.faces”??

<span class="container">

<span class="icon">

<a href="components.faces" target="content" title="Show the installed product services" class="iconXLargeApplications"></a>

</span>

<span class="text">

<a href="components.faces" target="content" title="Show the installed product services">Services</a><br/>

Specific component features. These settings affect the attributes and behaviors of specific components.

</span>

</span>

I’ve tried this, but no luck:

#include <IE.au3>

$oIE = _IECreate("<MY PAGE>")

Local $sMyString = "Services"

Local $oLinks = _IELinkGetCollection($oIE)

For $oLink In $oLinks

Local $sLinkText = _IEPropertyGet($oLink, "innerText")

If StringInStr($sLinkText, $sMyString) Then

_IEAction($oLink, "click")

ExitLoop

EndIf

Next

Link to comment
Share on other sites

I'm looking to click "Services" link. I want my script to find Services, and click it. There are other links just like it, similar html, where I need to find and click the link.

Is it possible to sniff out the html for "title=value" , and click the link associated with that??

Hopefully this makes sense.

Link to comment
Share on other sites

So I'm creating an auto script to deploy a file on my server. I'm actually running adobe livecycle on it. I'll leave the login portion out of my script. I'm able to login, but when I try to click on "Services", nothing happens. The script logs me in, but doesn't click "Services". I need to click "services", this brings me to another page, where I would need to click another link.

I can't figure out how to click "services" please help. :mad2:

#include

;URL / Login info hidden

$oIE = _IECreate($sURL)
$oUsername = _IEGetObjByName($oIE, "loginForm:j_username")
$oPassword = _IEGetObjByName($oIE, "loginForm:j_password")


_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)

;Find login button and click it
$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
If $oInput.value = "login" Then
_IEAction ($oInput, "click")
ExitLoop
EndIf
Next

;### This is where I'm stuck. "Services" isn't clicking
Local $sMyString = "Services"
Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
Local $sLinkText = _IEPropertyGet($oLink, "innerText")
If StringInStr($sLinkText, $sMyString) Then
_IEAction($oLink, "click")
ExitLoop
EndIf
Next

Here is the html code for the page that i need to click Services on:

<html xhtml="true">

     <head>
         <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
     <meta http-equiv="Cache-Control" content="no-cache"/>
     <meta http-equiv="Cache-Control" content="no-store"/>
     <meta http-equiv="Pragma" content="no-cache"/>
     <meta http-equiv="Expires" content="0"/>
     <title>Welcome</title>
     <style type="text/css">
     @import url("../css/cont.css");
     @import url("../css/icons.css");
     </style>
     </head>
     <body>

<div class="crumb">
<h2>Home</h2>
</div>
<div class="contextHelp">
<span>
    
     <a target='WWHFrame' href="http://www.adobe.com/go/learn_lc_admin_10" class="iconLargeHelp" >LiveCycle Administration Help</a>
</span>
</div>
<div class="title">
<h3>Home</h3>
</div>
<div class="instructionalText">
<h3 class="iconLargeAbout">
     Adobe LiveCycle Administration Console. This console allows you to modify product settings and view their states.
</h3>
</div>
<div class="category">

<span class="container">
    
     <span class="icon">
    
  [b]   <a href="components.faces" target="content" title="Show the installed product services" class="iconXLargeApplications"></a>
     </span>
     <span class="text">
    
    
     <a href="components.faces" target="content" title="Show the installed product services">Services</a><br/>
     Specific component features. These settings affect the attributes and behaviors of specific components.
     </span>
</span>[/b]

<span class="container">
    
     <span class="icon">
    
     <a href="settings.faces" target="content" title="Show the available platform settings" class="iconXLargeSettings"></a>
     </span>
     <span class="text">
    
    
     <a href="settings.faces" target="content" title="Show the available platform settings">Settings</a><br/>
     Cross-component global settings. These settings affect attributes and behaviors for all components.
     </span>
</span>

<span class="container">
    
     <span class="icon">
    
     <a href="about.faces" target="content" title="Show details about the installed products " class="iconXLargeAbout"></a>
     </span>
     <span class="text">
    
    
     <a href="about.faces" target="content" title="Show details about the installed products ">About</a><br/>
     License and copyright information on the installed features.
     </span>
</span>

</div>
<!-- Licensing Section. -->
<div class="title">
<h3>Licensing</h3>
</div>


<div class="instructionalText">

<h3 class="iconLargeAbout">
     <!-- Problem countering table styles for jsf, so injected, temporarily, the following style to force smaller fonts in the
     license table. -->
     <table border="0" style="font-family: Arial, Helvetica, sans-serif; font-size: 1em; color: #333333; background-color: #FFFFFF;">
     <tr>
     <td align="right"><span class="aboutItem">Current license:</span></td>
                 <td><b>DEV</b></td>
     <td align="right">Last updated on:</td>
     <td><b>6/8/12 2:10 PM</b></td>
     <td align="right">By:</td>
     <td><b>administrator</b></td>
     <td align="right">Status:</td>
     <td><b>Confirmed</b></td>
     </tr>
     <tr>
     <td align="right">Installation date:</td>
                 <td><b>6/8/12</b></td>
     <td align="right">Expiry date:</td>
                 <td><b>Never</b></td>
     <td colspan="4">&nbsp;</td>
     </tr>
    
     </table>
</h3>

</div>

<div class="category">
<span class="container">
    
     <span class="icon">
    
     <a href="license.faces" target="content" title="Update or confirm pending server license changes." class="iconXLargeApplications"></a>
     </span>
     <span class="text">
    
    
     <a href="license.faces" target="content" title="Licensing">Licensing</a><br/>
     Update or confirm pending server license changes.
     </span>
</span>
</div>

     </body>

</html>
Link to comment
Share on other sites

There's a difference between willing and able to lend a hand. Perhaps the other viewers, like myself, have no idea how to answer your question.

Plus you shouldn't be bumping your thread in less than 24 hours since the last time you did it, forum etiquette and all. The more you bump your thread, the less likely people are to help because you start to get annoying rather than desperate.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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