SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Junior Member
    Join Date
    Oct 2006
    Location
    NH, US
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    HTML ID and web pages

    I have a number of pages that change title depending on the customer. I can use regular expressions on either the title or the file name but there appears to be a delay in synchronizing when you use regular expressions in the Object Repository.

    I would like to identify the web pages in our app using the ID provided in the form or other elements (see code below) but Object Spy doesn't pick up a value for "html id" in the TO Properties and there is no "html id" or "id" field in the RO Properties.

    Here is the top piece of code from a page in our app (copied from view source):
    <font class="small">Code:</font><hr /><pre>
    &lt;!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"&gt;
    &lt;HTML&gt;
    &lt;HEAD&gt;
    &lt;title&gt;Admin Home&lt;/title&gt;

    &lt;!-- Stylesheet Personalization Begin --&gt;
    &lt;LINK href="StyleSheet/styles.css" type="text/css" rel="stylesheet"&gt;
    &lt;!-- Stylesheet Personalization End --&gt;

    &lt;script language="JavaScript" src="js_functions.js"&gt;&lt;/script&gt;
    &lt;/HEAD&gt;
    &lt;body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"&gt;
    &lt;form name="AdminHome" method="post" action="AdminHome.aspx" id="AdminHome"&gt;
    </pre><hr />
    Notice the id="AdminHome" in the last line. I would expect that to be the value placed in "html id" in the TO Properties for my page object but there is no value for this property.

    Does anyone know where the value for "html id" is grabbed from for a web page (or if it's even possible)? I've tried adding id="test1" to the "head" and "body" elements (in addition to the "form" element in the code) but Object Spy doesn't appear to pick up the value from any of these places in TO or RO Properties.

  2. #2
    Senior Member
    Join Date
    Jan 2000
    Location
    USA, CA
    Posts
    1,998
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    Tools --&gt; Object Identification --&gt;
    ComboEnvironment --&gt; select WEB --&gt;
    Mandatory Properties --&gt; Add/Remove --&gt;
    CheckBox "html ID"

    Browser and Page don't have "html id" property.
    Frame has. Other objects on the page - too.

    Janna

  3. #3
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    Is it neccesarry to use the HTML IDs? You can used normal page in OR, else micClass:=Page in case of DP.

  4. #4
    Senior Member
    Join Date
    Oct 2006
    Location
    Norway
    Posts
    191
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    I'm actually wondering about this too.
    Since I can't find the value displayed on the Application, I think perhaps I can use this "id" to uniquely identify a field across multiple language based sites. (For instance a "Log in" button across 10 different languages where the only difference is the Value:Log in or Value:Invia (italian) but where the "html id is : LogIn, or something like that)

    Then I could have a language undependable script like this.

    Browser("micClass:=Browser").Page("micClass:=Page" ).WebButton("html id:=LogIn", "Index:=0").Click

    Then no matter what the value of the button would be, I'd still be able to log in no matter what the button is called. (What the users see)
    - How many testers do you need to switch a light bulb? None, we just report it's dark -

  5. #5
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    Not sure this would work for all objects in language testing Erik, I have a fair bit of experience in language testing of the same website for different countries and have never managed to use 1 size fits all for all objects.

    The main culprits are Images &amp; Links.

    Unless your website is unique and you have a like tab across languages for all objects.

    Mark Smith.

  6. #6
    Senior Member
    Join Date
    Oct 2006
    Location
    Norway
    Posts
    191
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    Well, I had a look at two different language sites regarding links and images just to see the difference. (We have one product, and it's been "copied and pasted" over to other different languages)

    Navigate home image. Click on this and you're navigated to the welcome page: It has the following properties according to Spy.

    alt : MySite
    file name : logoMySite.gif
    html tag : IMG
    name : Image

    The foreign site's same image has these properties.

    alt : MyForeignSite
    class : logo
    file name : logoMyForeignSite.gif
    html tag : IMG
    name : Image

    (both have refrences to href and src, but they are not important in this case)

    Now, both images does not have any kind of "html id". So, if I could find out what needs to be in the code for "html id" to be included in the QTP properties, let's say the property where to be called "NavHome", I easily could have a common script to navigate home, like this.

    Browser("micClass:=Browser").Page("micClass:=Page" ).Image("html id:=NavHome", "Index:=0").Click

    And it would, in theory, work on all 10 sites.
    - How many testers do you need to switch a light bulb? None, we just report it's dark -

  7. #7
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    As I suspected, this would require dev to change the HTML ID, what I did in the case above (no common html id was present) was to load a language file for the relevant site. Here's what I would have done for the above:

    Norweigen File Contents
    =======================
    oImLogo="alt:=MySite"

    Foreign File Contents
    =====================
    oImLogo="alt:=MyForeignSite"

    QTP Code
    ========
    If Norway execute NorwayDefinitions.vbs
    Else execute ForeignDefinitions.vbs

    Browser ("micClass:=Browser").Page("micClass:=Page").Image (oImLogo).Click

    Mark Smith.

  8. #8
    Senior Member
    Join Date
    Oct 2006
    Location
    Norway
    Posts
    191
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    Hmmm.. the theory behind it is ok, the execution is however a little more confusing.

    But you're talking about 10 different language files in my "Associated function libraries". ?

    And then, based on which site I'm on, load the VBS that belongs to that site.

    I thought all VBS was loaded in the script when creating a new test. Can you actually decide which vbs is running???

    This code Im not sure how to implement:
    If Norway execute NorwayDefinitions.vbs
    Else execute ForeignDefinitions.vbs

    Although I think I would need a CASE here, not a IF.
    Case: "Norway"
    Load this file.vbs
    Case: "Italy"
    Load this file.vbs
    Case: "UK"
    Load this file.vbs
    Case: "Russia"
    Load this file.vbs
    Case: "China"
    Load this file.vbs
    - How many testers do you need to switch a light bulb? None, we just report it's dark -

  9. #9
    Senior Member
    Join Date
    Oct 2006
    Location
    Norway
    Posts
    191
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    Yet another question about HTML ID and web pages.
    I'm so lucky to work in an Agile environment, which means I have direct contact with developer and can influence on how the web page is developed.

    And now I'm trying to get them to use a unique id for displaying a value in a table. Problem is that we can't seem to find out what "triggers" the HTML ID in the spy.

    This is what the Source of the page gives me.
    &lt;table&gt;
    &lt;tr&gt;
    &lt;td&gt;Date&lt;/td&gt;
    &lt;td&gt;TodaysDate&lt;/td&gt;
    &lt;td rowspan="13" align="center"&gt;
    &lt;img src="" alt="pic"/&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;

    And I want todays date to have a unique ID, because todays date is displayed more than once on same page.
    Such as the spy find these kind of html ID:
    Html ID = "TodaysDateTop"
    Html ID = "TodaysDateMiddle"
    Html ID = "TodaysDateBottom"

    Anybody knows how this can be implemented in the code?
    - How many testers do you need to switch a light bulb? None, we just report it's dark -

  10. #10
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: HTML ID and web pages

    Eric, here's the HTML for a webelemt in one of my apps that has a html id property when you spy on it:

    &lt;div class="csa_class_bottom-area-user"&gt;&lt;div id="csa_id_footer-conf"&gt;Account Details
    &lt;/div&gt;

    Mark Smith.

 

 
Page 1 of 2 12 LastLast

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 10.71%
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 03:48 AM.

Copyright BetaSoft Inc.