Knowledge Base Article

Home Page > Knowledge Base > Rapise

Home Page > Knowledge Base > Rapise > Rapise Web

Article Executing Javascript commands against web browser

by Adam S on Tuesday, April 23, 2013

Sometimes you want to be able to open a browser window (e.g. Internet Explorer) and execute JavaScript commands directly against the DOM objects rather than using the Rapise Learned objects. This article explains the recommended way of doing this.

The important part is to use Navigator.Find(...) instead of Navigator.Open(...) because 'Find' connects to the browser instance in such a way that it is ready for subsequent calls to Navigator.ExecJS(...)

Normally this method is not used from outside Rapise, so we have to pass it 3rd and 4rth parameters to meet its needs. The 2nd parameter is an URL to be opened:

//Open up the IE browser window
Navigator.Find('/html', '
http://www.inflectra.com',null, {executable:"iexplore.exe"});
   
// Now do whatever is needed with IE instance
Navigator.ExecJS("....");

// Now we want to close the IE window

// We utilize the known IE hack to close a window without receiving prompt

Navigator.ExecJS("window.open('', '_self', ''); window.close();");
g_ieNavigator.process = null;
Global.DoSleep(3000);

 

Attachments
Article Info
Last Updated: 4/23/2013
Article ID: KB46
# Views: 2992
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2016 | Licensed to Inflectra Corporation.