SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    TP doesn\'t recognizes the Link under a Span

    Hello,

    I'm trying to record the ID of a Link on a website, but TP just recognizes the overlaying <span> Tag - please assume the following structure:

    <font class="small">Code:</font><hr /><pre>
    &lt;html&gt;
    &lt;head&gt;&lt;/head&gt;

    &lt;body&gt;
    &lt;div class="content_div" id="1"&gt;
    &lt;div class="link_div" id="2"&gt;
    &lt;a class="myCustomLink" id="3" href="http://www.google.com"&gt;
    &lt;span id="4"&gt;klick me.&lt;/span&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/body&gt;
    &lt;/html&gt;
    </pre><hr />

    When I start recording, the Pointer just gets the &lt;span&gt;, but ignores the underlying &lt;a href&gt; Tag. It would be great if someone could give me a hint,

    big thanks in advance,

    Chris

  2. #2
    Apprentice
    Join Date
    Jun 2012
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TP doesn\'t recognizes the Link under a Span

    My example is using Windows Internet Explorer as the browser.

    The issue is that you are recording. If you would use the identifying tool you would see what you are looking for. We rarely record and play here.

    The &lt;span&gt; immediately surrounds the text ‘klick me. If you move the identifier tool to the right of the ‘klick me’ text you will see the &lt;div&gt;. Look at the attached screen shot.
    Attached Images Attached Images

  3. #3
    Junior Member
    Join Date
    Sep 2012
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TP doesn\'t recognizes the Link under a Span

    I used the Identifier tool as well, unfortunately it doesn't get's the HTMLAnchor: if I use a simple Link, e.g. &lt;a href="http://www.example.com" id="3"&gt;Click me&lt;/a&gt; it works. The Problem is that I'm using a Framework which generates the HTML, and I need to find a way to record the ID of the HTMLAnchor even if it contains a &lt;Span&gt;...

  4. #4
    Apprentice
    Join Date
    Jun 2012
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TP doesn\'t recognizes the Link under a Span

    I am going to give you some code that I used to discover all Anchor tags on an HTML page. You will have to modify it for your needs and ignore some of my custom function calls. WriteToErrorLog() is one of my functions that you can remark out. FastWaitWindowExists() is another.

    It works by looking for up to 500 anchor tags by iterating through the index numbers and checking to see if they exist.

    <font class="small">Code:</font><hr /><pre>

    Sub Discover_all_AnchorTags(svFileName As String)

    Dim nvIndex As Integer
    Dim svHref As String
    Dim svResult As String
    Dim nvNum As String
    Dim svCaptionText As String

    ChDir APEX_PATH

    Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE " &amp; svFileName, vbMaximizedFocus)

    Call FastWaitWindowExists("Application=IEXPLORE.EXE ClassName=IEFrame", Me.Name)

    IEWindow("Application=IEXPLORE.EXE ClassName=IEFrame").Attach

    Pause 2, tpPauseSeconds

    ' Attach to the browser window.
    HTMLBrowser("ClassName=HTML.Browser").Attach

    For nvIndex = 1 To 500

    If HTMLAnchor("Application=IEXPLORE.EXE Index=" &amp; Trim(CStr(nvIndex)) &amp; "", tpAttachNoWait).Exists = True Then
    'TestLog.Comment "Found HTMLAnchor tag " &amp; Trim(CStr(nvIndex)) &amp; " URL = " &amp; HTMLAnchor("Application=IEXPLORE.EXE Index=" &amp; Trim(CStr(nvIndex)) &amp; "").Href
    svHref = HTMLAnchor("Application=IEXPLORE.EXE Index=" &amp; Trim(CStr(nvIndex)) &amp; "").Href
    svCaptionText = HTMLAnchor("Application=IEXPLORE.EXE Index=" &amp; Trim(CStr(nvIndex)) &amp; "").Caption
    If InStr(1, svHref, "file:", vbTextCompare) &gt; 0 Then
    ' Strip the 1st 8 characters from the front of the URL to remove 'file:///' from the URL. This will leave a full file\path.
    svResult = Right(svHref, Len(svHref) - 8)
    ' Now replace the forward slashes with backslashes
    svResult = Replace(svResult, "/", "\", 1, -1, vbTextCompare)
    ' Now replace the HTML character sequence '%20' string with a blank space.
    svResult = Replace(svResult, "%20", Chr(32), 1, -1, vbTextCompare)
    ' Now strip off any mapid's at then end of the file name.
    nvNum = InStr(1, svResult, "#", vbTextCompare)
    If nvNum &gt; 0 Then
    svResult = Left(svResult, nvNum - 1)
    End If
    'TestLog.Comment "URL = " &amp; svHref &amp; " Stripped to " &amp; svResult
    ' Now see if the URL exists.
    If DoesExist(svResult, "FILE") = False Then
    WriteToErrorLog Me.Name, "The link with the caption text of '" &amp; svCaptionText &amp; "' with a target URL = " &amp; svHref &amp; " cannot be found on the Help file named = " &amp; svFileName, True
    Else ' OK to click - it passes
    'TestLog.Comment "Passes URL = " &amp; svHref &amp; " Caption = " &amp; svCaptionText
    End If
    End If

    Else
    Exit For
    End If

    Next nvIndex

    Call StopProgram("IEXPLORE.EXE")

    End Sub</pre><hr />

  5. #5
    Junior Member
    Join Date
    Sep 2012
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TP doesn\'t recognizes the Link under a Span

    @Ozone - thanks for sharing this, I'll give it a try soon (out of Office at the moment).

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.11%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:55 PM.

Copyright BetaSoft Inc.