Page 1 of 1

How to execute Javascript via code

Posted: Wed Dec 06, 2017 11:36 am
by Sundaytwins
Hi,

I'm currently testing a web application in which there is an impossibility to test a certain functionality by just 'clicking' it.
Therefor, the solution that can help is to execute the JS behind the button.

Now I'm struggling to have the JS executed.

When i first tried with:

webdocument webDoc = "/dom[@domain='ourdomain']";
webDoc.ExecuteScript("BcsCommon.app.blabla.instance.scripttoExecute(['Argument'])");

Ranorex replied :
The type or namespace name 'webdocument' could not be found (are you missing a using directive or an assembly reference?) (CS0246)

Elsewhere i found that i needed the 'Microsoft Internet controls' reference.
I tried to add it, but now the error reads:

Task failed because "AxImp.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "AxImp.exe" in the "bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the "ToolPath" parameter of the task. (MSB3091)

Can anyone help please? I'm unable to install software to the machine as i'm not local admin for it.

Re: How to execute Javascript via code

Posted: Wed Dec 06, 2017 12:29 pm
by odklizec
Hi,

In my opinion (and the errors you are getting support this opinion), there are not installed all required libs? Typically, Ranorex installs all required/missing libs during the setup. Just in case, go to this page and examine the list of required software and make sure all of them are installed on your system...
https://www.ranorex.com/help/latest/system-requirements
I'm afraid, if you don't have rights to install things onto the computer in question, you will have to ask someone to do this for you or ask someone to grant you with required rights.

Re: How to execute Javascript via code

Posted: Wed Dec 06, 2017 1:11 pm
by Sundaytwins
Hi,

Thanks for your quick reply. I checked all packages and they are available on my computer.
I recently updated my PC to Ranorex version 7.2 (which took me almost two weeks to get the necessary rights to do it).
That's why I wrote that i don't have access to install stuff. (it just takes ages and i need a pretty good reason to do so)

I guess, all required packages were installed from the installation/update i performed.

Still, the problem remains....

Re: How to execute Javascript via code

Posted: Wed Dec 06, 2017 3:11 pm
by Sundaytwins
Hi,

Found the reference problem and it occurs to be a typo...

No reference errors anymore, but js is not running yet.
We'll keep trying.

Re: How to execute Javascript via code

Posted: Thu Dec 07, 2017 1:16 pm
by Vaughan.Douglas
Sundaytwins wrote:Hi,

Found the reference problem and it occurs to be a typo...

No reference errors anymore, but js is not running yet.
We'll keep trying.
Just for clarification, you're not getting ANY errors anymore? It's now a case of nothing happens?