Page 1 of 1

I have no more ideas...

Posted: Mon Feb 16, 2009 9:35 am
by StuByZurich
Hi,

I got here two lines code of the ranorex webtest-example.

Code: Select all

System.Diagnostics.Process.Start("iexplore.exe", "www.ranorex.com/web-testing-examples");
WebDocument webDocument = "/dom[@caption='Ranorex Test Page']";
When I run this code within Ranorex Studio it works.

But when I paste this code in my VS 2005 project and run it, it does not work.

The webDocument can not be found and be created !!!????

Does I understand anything wrong????

Why is this behavior diffrent???

Regards,
Oliver

Posted: Mon Feb 16, 2009 9:59 am
by Support Team
Is your main thread using an STA apartment state? This is needed for web elements to be found, i.e. your Main method must be marked with the STAThread attribute.

If you create a project in Ranorex Studio, the Main methods are already marked with the STAThread attribute.

Regards,
Alex
Ranorex Support Team

Posted: Mon Feb 16, 2009 10:06 am
by StuByZurich
Hi,

Yes! You got it :-))
This attribute was set as comment in my project :-((
The WebDocument is now instancieted....

Many thanks,
Oliver