SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to call SilkTest functions ExecLine, ExecScript, ExecFunction

    I've done searches on the forum for javascript and the Silktest functions for calling javascript. I just discovered that they exist, and I am eagerly hopeful that they can help me with those things in our web app (an enterprise portal) that have javascript in the webpages.

    I'm using SilkTest 5.5.3, IE5.5 DOM.

    I've read all the posts I can find here, and excitedly tried writing little practice testcases to use the functions, and no luck.

    There are places where clickable images are made to show or hide, text turns red for error conditions, that sort of thing, with the javascript. For example, on one page there are a couple of textfields with radio buttons next to them. I find in the html there are 2 functions, one for the left, one for the right, that look like this:

    So I wrote

    and got

    *** Error: ExecScript() generated an error
    Occurred in HomePage.ExecScript
    Called from fun at tryitout.t(33)

    Why an error from ExecScript when I called ExecLine?

    Then I tried

    and got the same error

    And I tried

    and got an error saying

    *** Error: ExecFunction() generated an error

    I thought I picked a very simple javascript function off the page. The example I see all over the other posts here, to ExecLine('alert("hello")') works fine.

    So the javascript works, but there's something wrong in my calling it with the Silk functions.

    ------------------

  2. #2
    Member
    Join Date
    Sep 2001
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to call SilkTest functions ExecLine, ExecScript, ExecFunction

    I haven't played with these Silk functions but I remeber from a while back that I worked with javascript and that adding the 'javascript:' keyword before a function call fixed a bunch of things. If you haven't already tried it you could try the following code:



    ------------------

  3. #3
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to call SilkTest functions ExecLine, ExecScript, ExecFunction

    Thanks, but no luck. Same error message. For a moment my heart leaped. So often it's been such a small piece that's been missing from a puzzle.

    ------------------

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to call SilkTest functions ExecLine, ExecScript, ExecFunction

    I think my problem is actually more general than I presented it. I've talked some with one of the developers who works with the code for the pages, and he's waved me away from what I thought I would try to do.

    The problem, as I said above, is that depending on how the user interacts with the pages at certain points, javascript functions are called that make certain objects display or not. Nothing like cool images flashing, mainly just text items - if the user enters invalid information in a text field, the error checking in the page calls the appropriate function to make one error message or another appear above the textfield, and the label for the textfield turns red. Actually, the text doesn't change color, rather a black version of the text is hidden and a red version of it is shown. Both objects are located at exactly the same pixel location, so the text appears to turn red, that's all.

    My problem is that at my level of knowledge of SilkTest, I haven't found any way to determine what's on the screen - my eyes tell me the red text is there, but to Silk, it seems that since both objects are in the code, both objects respond to

    Exists()
    IsActive()
    IsEnabled()
    IsVisible()

    with a return value of TRUE. I'm stuck. For a while I was using bitmaps, but that was very tedious, and the slightest thing would make them not match, so I gave up there.

    The idea with learning how to use javascript with Silk calls to ExecLine(), etc, was I thought I might get javascript code to dig out something having to do with the objects' properties like "object.visibility" or "object.hide" or some such.

    Anyway, the developer ran through a bunch of potential problems he could think of that would make it a risky strategy, and came back at me with -- "Hey, SilkTest is a powerful tool, made for testing GUI's -- it must have the ability in its own self to get what you want, without asking it to call something from javascript to aid in the discovery of the information you want to verify"

    So, in a more general way -- is there some way in Silk that I am not aware of yet, to tell when a text item is on the screen, when it's controlled in its display by javascript? It's always there, just shows or not on call.

    ------------------

  5. #5
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to call SilkTest functions ExecLine, ExecScript, ExecFunction

    Here's a good example of what I've got to work with. This is from a page with textfields for the portal user to add a page to his account - the new page appears as a tab in a tabset, just like at the top of the QAForums pages here. I cut and pasted from the Record Window Declarations:

    So there are two different htmltext objects on the page, different tags, at the same location. The AddTabDivText that's normally displayed is in black text, as defined in the html of the page. The AddTabDivError is normally hidden, and its html definition sets it to red. If a user clicks "Done" with an empty "Add new page" textfield, or with invalid characters (you know that kind of textfield error checking), a javascript function calls to hide the first one and display the second, along with an explanatory error message "You must enter a name in the textfield". So the text doesn't really change color, rather one text disappears and the other appears.
    Since they have separate declarations and separate names, I hoped that there would be some property or state or attribute that could be determined "live",

    Verify(Page.AddTabDivText.Exists(), TRUE)
    Verify(Page.AddTabDivError.Exists(), FALSE)

    but all the methods I know of say they both exist, they both are active, enabled, visible, etc. I've recorded the declaration in both states, and in both states both objects are seen by SilkTest as "being there".

    What to do to verify that when a user makes an error, the text "changes" from black to red?

    Thanks

    ------------------

  6. #6
    Super Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    1,882
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to call SilkTest functions ExecLine, ExecScript, ExecFunction

    What does the Window Declaration for the object look like that you are trying to get the text color of?

    ------------------
    James Soderborg
    http://www.ameliortech.com
    jamesso@ameliortech.com

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 02:35 AM.

Copyright BetaSoft Inc.