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 FFhtmlControl.Click(); //error in FF onlyhtmlControl.MouseClick(MouseClickType.LeftClick); //error in FF onlymyManager.Desktop.Mouse.Click(MouseClickType.LeftClick, mybtn.GetRectangle());//error in IE and FFmyManager.ActiveBrowser.Actions.Click(mybtn);//error in FF and IEmyManager.ActiveBrowser.Actions.InvokeEvent(mybtn, ScriptEventType.OnClick);myManager.Dispose();<html><head></head><frameset cols="25%,*,25%"> <frame src="frame_a.html" /> <frame src="frame_b.html" /> <frame src="frame_c.html" /></frameset></html><html><body><input type="button" name="press_me" value="press_me" onclick="alert('Hello world!')"/></body></html>Unhandled Exception: ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!InError set by the client. Client Error:System.ArgumentException: Tag collection is either empty or has less elements than the element occurrence requested. RequestedIndex: '0', ElementLength: '0' at ArtOfTest.InternetExplorer.IECommandProcessor.FindElement(ElementIdMessage id) at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request) at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)BrowserCommand (Type:'Action',Info:'NotSet',Action:'Click',Target:'ElementId (tagName: 'input',occurrenceIndex: '0')',Data:'',ClientId:'Client_44818831-9568-46b5-9a23-3ad5285d5c64',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.ArgumentException: Tag collection is either empty orhas less elements than the element occurrence requested. RequestedIndex: '0', ElementLength: '0' at ArtOfTest.InternetExplorer.IECommandProcessor.FindElement(ElementIdMessage id) at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request) at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')InnerException: none. at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request) at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean 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 42Hello,
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.
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.
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.
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(); }