Contributions
Re: catch error then perform specific task
hi tristaanogre, Thank you for your reply. your suggestion work well for me below is the code i use, which is actually from AlexKaras if (!obj.VisibleOnScreen) { obj.scrollIntoView(true); if (!obj.VisibleOnScreen) { obj.scrollIntoView(false); } } obj.Click();2.9KViews1like6Commentscatch error then perform specific task
Hi, during playback i get this error : There was an attempt to perform an action at point (X, Y) which is transparent or out of the window bounds. i know what is causing this error : because my web page have scroll bar and test complete is trying to click on object with is hidden, if i manually drag the scroll bar to show the object, then the error is gone. what i want to do : i would like to catch this error by using an if,else script. If this error happen then i run a script to move the scroll bar what i did : i tried using 'try .. catch ..' but it does not work. try { obj.click(); } catch (e) { Log.Error(e.description + "Specific Text"); //execute script here } how can i catch the error and then perform a specific script to move the scroll bar ?Solved3KViews0likes9Commentscatch error then perform specific task
Hi, during playback i get this error : There was an attempt to perform an action at point (X, Y) which is transparent or out of the window bounds. i know what is causing this error : because my web page have scroll bar and test complete is trying to click on object with is hidden, if i manually drag the scroll bar to show the object, then the error is gone. what i want to do : i would like to catch this error by using an if,else script. If this error happen then i run a script to move the scroll bar what i did : i tried using 'try .. catch ..' but it does not work. try { obj.click(); } catch (e) { Log.Error(e.description + "Specific Text"); //execute script here } how can i catch the error and then perform a specific script to move the scroll bar ?Solved1.9KViews0likes3CommentsRe: search object with dynamic id using find Child By X Path
HiAlexKaras, Thank you for your reply. i was having trouble using findchild function, i know and understand that you advice me to avoid using xPath but i found one code that is working for my case. I'll try my best to avoid xPath for test complete in future. Below, i would like to share the code that i am using .. var obj = ChildByXPath("//*[starts-with(@id, 'ABC-')]"); function ChildByXPath(xpath) { var page = Sys.Browser("Chrome").Page("*"); var obj = page.FindChildByXPath(xpath, true); if (obj != null) { return obj; } else { Log.Error("The element was not found."); } }1.4KViews0likes0CommentsRe: Search object using Name attribute
Hi Marsha_R, Thank you for your reply. I don't know why i still can't search object using Name attibute Instead of using Name i now change toObjectIdentifier var GetValue2 = page.NativeWebObject.Find("ObjectIdentifier",intValue,"td"); var intPass = aqObject.GetPropertyValue(GetValue2, "contentText"); Log.Message(intPass); the code above work well without any problem for me.1.3KViews0likes1Commentsearch object with dynamic id using find Child By X Path
hi, i am using ChildByXPath function to look for object on web but i am having problem because the id is dynamic. id = ABC-60 the value 60 will keep changing on every click. what i want to do is, find the object using only ABC- and leave the value behind blank and when test complete search for the object it will searchfor every object that contain ABC- so regardless of what value is after ABC- test complete will be able to click on it. How can i do that ? Below is my code : var obj= ChildByXPath("//*[@id=\"ABC-60\"]"); function ChildByXPath(xpath) { var page = Sys.Browser("Chrome").Page("*"); var obj = page.FindChildByXPath(xpath, true); if (obj != null) { return obj; } else { Log.Error("The element was not found."); } }Solved1.5KViews0likes2CommentsRe: How to check if a string is a number
hi AlexKaras, thank you very much for your reply, i manage to write the code and i posted a reply here as well, to share my workable code with others. i am new in coding (1 week old, haha), don't even know what question to ask, will take note on the things you mention, will improve my question asking skill on coding in future thanks a lot2.5KViews0likes0CommentsRe: How to check if a string is a number
hi Shankar_r, thank you for your reply, i was lost and don't know how to start writing the code but your code help me to kick start writing, i will keep your code for future reference, thanks a lot. This is what i manage to come up with : var ABC = 123; if(isNaN(ABC)) { Log.Message(ABC + " is not a number"); } else { Log.Message(ABC + " is a number"); } this code work well without any problem for me, i am not sure if this is the correct code for test complete because NaN is what i get from jscript, hopefully it won't cause any bug in future, haha ..2.6KViews1like0Comments