User code, selenium endpoint

Best practices, code snippets for common functionality, examples, and guidelines.
boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

User code, selenium endpoint

Post by boegvald » Tue May 03, 2022 10:46 am

We are starting to use selenium endpoints for execution of some tests. The endpoint config is being setup in Ranorex Studio UI using JSON (as per the documentation from Ranorex). Now, I cannot figure out how to communicate with the driver via user code.

I have found the following code snippet for finding out if a test is executed on a Selenium endpoint:

Code: Select all

public static void CloseSession()
        {
        		var webDriverEndpoint = Host.Current.TryGetAsWebDriverEndpoint();
		        if(webDriverEndpoint == null)
		            Report.Info("Selenium", "Test is currently not running on a selenium Endpoint");
		        else
		          <your code here>
Now, I do want to communicate with driver, for example by issuing driver.close() or driver.quit() commands.

But how do I address the "driver" Ranorex has instantiated?
Best Regards

Bo

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: User code, selenium endpoint

Post by odklizec » Tue May 03, 2022 10:56 am

Hi,

I believe this post should help?...
https://www.ranorex.info/back-button-on ... tml#p55275
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: User code, selenium endpoint

Post by boegvald » Tue May 24, 2022 10:45 am

Yes! That helps a lot. Thanks much (again), Pavel.
Best Regards

Bo

KennethBrown
Posts: 2
Joined: Tue May 31, 2022 2:09 pm

Re: User code, selenium endpoint

Post by KennethBrown » Tue May 31, 2022 2:11 pm

Thanks! It helpful.