unable to find dom

Ask general questions here.
kumprave5
Posts: 33
Joined: Wed Jul 18, 2018 9:55 pm

unable to find dom

Post by kumprave5 » Tue Aug 07, 2018 10:11 pm

1. unable to find dom but still status is success but surprisingly going into catch block.
void ITestModule.Run()
        {
        	
        	var tm=TestReport.CurrentTestModuleActivity;
        	Script sc = new Script();
			try
			{
				Report.CurrentReportLevel = ReportLevel.Info;
                               TestReport.EnableTracingScreenshots =false;
                             sc._startBrowser("chrome.exe", "https://www.google.com/");
                
                             WebDocument wd ="/form[@title='New Tab - Google Chrome']"; //unable to find dom still satus shows passed
                             LogUtility._info("dom found successfully");
    
			}
			catch(Exception e)
			{
				LogUtility._info("I am in the catch");
                                string status = tm.Status.ToString();
				LogUtility._failure(status, "Test", e, "I am failed");
				
			}
        }
Edit by Support Team: Use code tag for better readability

User avatar
Stub
Posts: 173
Joined: Fri Jul 15, 2016 1:35 pm

Re: unable to find dom

Post by Stub » Wed Aug 08, 2018 8:34 am

Have you instrumented your browser? If applicable, have you whitelisted your browser in Ranorex v8.2? I don't use Ranorex to interact with web browsers like you are, so your code is unfamiliar to me, but are you waiting long enough for things to happen before looking for something?

kumprave5
Posts: 33
Joined: Wed Jul 18, 2018 9:55 pm

Re: unable to find dom

Post by kumprave5 » Wed Aug 08, 2018 1:16 pm

If possible, can you please suggest your way to interact with web browser?

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: unable to find dom

Post by asdf » Thu Aug 09, 2018 3:48 pm

Have you already tried to simply record some steps in Google Chrome?
Furthermore, I saw that your RxPath is pointing to the form element of Chrome instead of the WebDocument which RxPath should be something like: /dom[@url='www.google.com'].