Telerik Forums
Testing Framework Forum
10 answers
225 views
Hi everyone.

We are testing a web-application with framed main window, so our tests look lite that:

Settings mySettings = new Settings(BrowserType.FireFox, @"d:\");
mySettings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
 
Manager myManager = new Manager(mySettings);
 
myManager.Start();
myManager.LaunchNewBrowser();
 
myManager.ActiveBrowser.NavigateTo("file:///d:/test.html");
Element mybtn = myManager.ActiveBrowser.Frames[0].Find.ByName("press_me");
HtmlControl htmlControl = new HtmlControl(mybtn);
 
//fine in IE and FF
htmlControl.Click();
 
//error in FF only
htmlControl.MouseClick(MouseClickType.LeftClick);
 
//error in FF only
myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, mybtn.GetRectangle());
 
//error in IE and FF
myManager.ActiveBrowser.Actions.Click(mybtn);
 
//error in FF and IE
myManager.ActiveBrowser.Actions.InvokeEvent(mybtn, ScriptEventType.OnClick);
 
myManager.Dispose();

Here you can see finding a button in the first frame and then clicking it in five different ways.

The html code is like that:

<html>
<head></head>
<frameset cols="25%,*,25%">
  <frame src="frame_a.html" />
  <frame src="frame_b.html" />
  <frame src="frame_c.html" />
</frameset>
</html>

and the frame_a.html is
<html>
<body>
<input type="button" name="press_me" value="press_me" onclick="alert('Hello world!')"/>
</body></html>


But after I tested the code, I discovered that FF fails to click on it almost in every case, and IE fails in the last two.
Though the code and HTML page seem valid, could somebody, please, tell what is wrong?
Using IE 7, FF 3.6.7 and 3.5.1, WebAii 2.0 the lates build.

The error produced is like
Unhandled Exception: ArtOfTest.WebAii.Exceptions.ExecuteCommandException: Execut
eCommand failed!
InError set by the client. Client Error:
System.ArgumentException: Tag collection is either empty or has less elements th
an the element occurrence requested. RequestedIndex: '0', ElementLength: '0'
   at ArtOfTest.InternetExplorer.IECommandProcessor.FindElement(ElementIdMessage
 id)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(Browse
rCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserCla
ss ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'Click',Target:'ElementId (ta
gName: 'input',occurrenceIndex: '0')',Data:'',ClientId:'Client_44818831-9568-46b
5-9a23-3ad5285d5c64',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InErr
or:'True',Response:'System.ArgumentException: Tag collection is either empty or
has less elements than the element occurrence requested. RequestedIndex: '0', El
ementLength: '0'
   at ArtOfTest.InternetExplorer.IECommandProcessor.FindElement(ElementIdMessage
 id)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(Browse
rCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserCla
ss ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.
 
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand reques
t)
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boole
an performDomRefresh, Boolean waitUntilReady)
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
   at ArtOfTest.WebAii.Core.Actions.Click(Element targetElement)
   at testMouseClick.Program.Main(String[] args) in C:\Documents and Settings\My Documents\Visual Studio 2008\Projects\testMouseClick\testMouseClick
\Program.cs:line 42


Thanks
Yaroslav
kovyar
Top achievements
Rank 1
 answered on 10 Aug 2010
3 answers
91 views

Hello, 

I'm getting some strange problem since I updated my FireFox from 3.5.5 to 3.6.3 last week. When I'm looking for element like this : 

<span xmlns="" class="label_url_addDiscount_constant">
<a href="/PA_Klient_Finanse_Rabaty_DodajRabat_Staly.html?clientID=456083">
<img border="0" src="/buttons/pierwszy/dodaj rabat stały.gif" alt="dodaj rabat stały"/>
</a>
</span>

using code similiar to 

Element el = find.ByExpression("alt=dodaj rabat stały");
actions.Click(el);

i got exception 

'2010-05-05 10:21:54.265 ' - [Trace] : Exception: ExecuteCommandException Message: ExecuteCommand failed!
InError set by the client. Client Error:
mozCommandProcessor: FindElement(): Tag collection is either empty or has less elements than the element occurrence requested.TagName: a4:img, Occurrence Requested: 0, All Tags Collection length: 0
BrowserCommand (Type:'Information',Info:'ElementRectangle',Action:'NotSet',Target:'ElementId (tagName: 'a4:img',occurrenceIndex: '0')',Data:'',ClientId:'Client_4a2adc76-44ce-4b9e-8e28-1c16bc02a364',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'mozCommandProcessor: FindElement(): Tag collection is either empty or has less elements than the element occurrence requested.TagName: a4:img, Occurrence Requested: 0, All Tags Collection length: 0')
InnerException: none.

This happend only in FireFox 3.6.3 in older FF version (3.5.5) everything is fine. 

Konstantin Petkov
Telerik team
 answered on 10 Aug 2010
7 answers
166 views
Totally stuck… Our website loads just fine in Firefox when not using WebAii. However, when I load it with WebAii, I get the white screen of death. I can load other web pages with Silverlight using WebAii. There are no errors in the Firefox Error Console. I notice that WebAii thinks the page is done loading while IIS is still sending the XAP to the browser. However, even if I sit there in debug mode, it never loads the Silverlight control (even after IIS finishes). Maybe there is some kind of timeout? We load our Silverlight control inside of an IFRAME. Totally stuck, any ideas are welcome.
Cody
Telerik team
 answered on 09 Aug 2010
1 answer
108 views
Internet Explorer (7/8, haven't tried others) doesn't honor clearing the cookies until the browser has been closed. Is there any way around this? I'm trying to speed up our tests by using browser persistance, but IE isn't making this simple.
Cody
Telerik team
 answered on 09 Aug 2010
1 answer
81 views
Hi there,
Can your product run with Safari?
Thanks
RC
Konstantin Petkov
Telerik team
 answered on 09 Aug 2010
5 answers
148 views
Hi there,

we are evaluating WebUI Developer edition with WIndows7/VS2010. Our silverlight aplication is using Tooltip property for displaying validation messages on TextBox controls. There was no mean to record that through WebUI. When hover the mouse it was showing a path control instead which doesn't reflect any of the tooltip properties.

Any help is highly appreiciated!

 
Konstantin Petkov
Telerik team
 answered on 06 Aug 2010
5 answers
228 views
Hey all,

I couldn't immediately figure this out, as it doesn't seem obvious, but what controls element lookup timeouts?  Which setting is it?  None of the Manager.Settings properties seems directly related to this particular action.  I have an idea that ExecuteCommandTimeout might, but ExecutionDelay could, too.

I'm extremely tired, so perhaps my observation skills leave something to be desired at the moment.  ;-)


Thanks,
Steven
Cody
Telerik team
 answered on 03 Aug 2010
3 answers
205 views
Hi,

I am using WebAii 2.0 for automating silverlight 3 application.

I need to get all the types in a control through Find . Also it should recursively check the children aslo.

I tried the below but i got nothing

IList

<FrameworkElement> elmnts = grid.Find.AllByType<FrameworkElement>();

I neded this if i am automating any customUserControl which was developed by someone else and i dont know anything about the controls used in that.
So i need to know all the elements in that control.

Also can you suggest some tools to see the visual tree like UISpy.

 


Thanks
Kiran
Konstantin Petkov
Telerik team
 answered on 02 Aug 2010
9 answers
178 views
I am using the 2010.1.713.0 WebAii code with its Telerik.WebAii.Controls.Html.dll Translator for ASP.NET AJAX RAD Controls. I am using the latest controls dll 2010.2.713.35.

var ed2 = Find.ByCustom<Telerik.WebAii.Controls.Html.RadEditor>(a => a.ID.EndsWith("MqTelerikEditor"));

Assert.IsNotNull(ed2, "Did not find the editor");

const string html = "Test Code";

 

ed2.Html = html;

This test fails on the last line with this exception and stack dump.

ArtOfTest.WebAii.Exceptions.ExecuteCommandException : ExecuteCommand failed!
InError set by the client. Client Error:
System.InvalidOperationException: Javascript call [$find(\'ctl00_cContent_ctl00_MqTelerikEditor\').set_html(\'Test Code\')] failed! Please make the function exists and the call is using the correct prototype signature. Javascript error: [object Error] 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunction',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'$find(\'ctl00_cContent_ctl00_MqTelerikEditor\').set_html(\'Test Code\')',ClientId:'Client_0f07abc3-99d2-47b2-aa1e-aa5d60203816',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.InvalidOperationException: Javascript call [$find(\'ctl00_cContent_ctl00_MqTelerikEditor\').set_html(\'Test Code\')] failed! Please make the function exists and the call is using the correct prototype signature. Javascript error: [object Error] 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.


I am guessing there is a miss match with the Translator and that I need a 2010.2 version. Is this due?

When I watch the test run I see the content of the Editor does take the new content just before it crashes out.

John.

Petia
Telerik team
 answered on 02 Aug 2010
4 answers
129 views
Hi Guys, 

Using Nunit, FF (3.0.19), VSE 08. 

I'm using the following code to click a button (AJAX buttons are handled  in a slightly different way..):
public void ClickButtonByGUICaption(String buttonGUIName)
   {
       StringBuilder buffer = new StringBuilder();
       buffer.Append("//input[@value=\"")
             .Append(buttonGUIName)
             .Append("\"]");

       Manager.ActiveBrowser.Find.ByXPath<HtmlInputSubmit>(buffer.ToString()).Click();
       Manager.ActiveBrowser.WaitUntilReady();
   }
The above works well at most scenarios except a few in which the above is followed by an assertation  of some kind as 
check if txt exists ext. 
The test passes however when 'executionDelay'  value is increased from 100-150 to 800 or more, indicating the issue is not the code (In a sense that I'm not looking for the wrong element etc). 

Am I using/understanding WaitUntilReady method wrongly ? My assumption is that if WaitUntilReady
is the last action the ClickButtonByGUICaption ()initiates, there should be no issues initiating any kind of verification/action past that point on the page that loads as the page is supposed to be ready. Does ready = fully loaded ?

Pls note that using WaitForElement/Frame maybe quite tedious in my case as I have a large number of situations so I need to use a more generic solution as the above. 

Ta, 
SD. 
 














SD
Top achievements
Rank 1
 answered on 30 Jul 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?