I have no more ideas...

Ask general questions here.
StuByZurich
Posts: 18
Joined: Fri Jan 23, 2009 2:04 pm

I have no more ideas...

Post by StuByZurich » Mon Feb 16, 2009 9:35 am

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Mon Feb 16, 2009 9:59 am

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

StuByZurich
Posts: 18
Joined: Fri Jan 23, 2009 2:04 pm

Post by StuByZurich » Mon Feb 16, 2009 10:06 am

Hi,

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

Many thanks,
Oliver