This question is locked. New answers and comments are not allowed.
Hello,
I found some strange issues when testing on local pages (
I made this simple test using WebAii:
The
When I execute this code with InternetExplorer, this is the result:
Gives error on this line:
The error message:
The error stack trace:
Comment: Doesn't matter if image exists or not, it gives me always the same exception.
When I execute this code with FireFox, gives me:
Test passed if the image exists;
Firefox Timeout exception if the image does not exist; (if I hit esc key on firefox, it gives me
Comment: Seems that everything is ok with firefox.
When I execute this code with Chrome, gives me:
Comment: Doesn't matter if image exists or not, the Assert.IsNull always fail.
Final comment: I found this issue by lucky, because my work does not depend on this issue. I was just doing a simple test to
Best Regards,
Bruno Almeida
I found some strange issues when testing on local pages (
file:///C:/Users/xxxxx/Desktop/Newfolder/apagar.html
)I made this simple test using WebAii:
[TestMethod]
public
void
SampleWebAiiTest()
{
// Launch a browser instance
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
// The active browser
ActiveBrowser.NavigateTo(
"file:///C:/Users/xxxxx/Desktop/Newfolder/apagar.html"
);
HtmlImage image = Find.ByXPath<HtmlImage>(
"//img"
);
Assert.IsNotNull(image,
"It is null"
);
Assert.IsTrue(image.IsLoaded(),
"Not loaded"
);
}
The
file:///C:/Users/xxxxx/Desktop/Newfolder/apagar.html
content is:<
html
>
<
body
>
<
img
src
=
"logo_emp.gif"
/>
</
body
>
</
html
>
When I execute this code with InternetExplorer, this is the result:
Gives error on this line:
Assert.IsTrue(image.IsLoaded(),
"Not loaded"
);
The error message:
Test method TestProject1.PrimeiroTeste.SampleWebAiiTest threw exception: ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
InError set by the client. Client Error:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at mshtml.HTMLWindow2Class.IHTMLWindow2_execScript(String code, String language)
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:'document.getElementsByTagName(\'img\')[0].complete',ClientId:'Client_dbcb2607-43c7-4274-a576-192dda2d1841',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at mshtml.HTMLWindow2Class.IHTMLWindow2_execScript(String code, String language)
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.
The error stack trace:
ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
ArtOfTest.WebAii.Core.Actions.InvokeScript(String script)
ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions.InvokeScript(String script)
ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.GetValue[T](String propertyName, T defaultValue)
ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.GetValue[T](String propertyName)
ArtOfTest.WebAii.Controls.HtmlControls.HtmlImage.IsLoaded()
TestProject1.PrimeiroTeste.SampleWebAiiTest() in D:\testes_automaticos\Formacao\TestProject1\TestProject1\Formacao\Google\Tests\PrimeiroTeste.cs: line 163
Comment: Doesn't matter if image exists or not, it gives me always the same exception.
When I execute this code with FireFox, gives me:
Test passed if the image exists;
Firefox Timeout exception if the image does not exist; (if I hit esc key on firefox, it gives me
"Not loaded"
, so it is ok, its firefox issue)Comment: Seems that everything is ok with firefox.
When I execute this code with Chrome, gives me:
"It is null"
Comment: Doesn't matter if image exists or not, the Assert.IsNull always fail.
Final comment: I found this issue by lucky, because my work does not depend on this issue. I was just doing a simple test to
HtmlImage.IsLoaded() method.
If the web page is not local, it works fine on all browsers.Best Regards,
Bruno Almeida