How to programmatically open and refresh browser

Ask general questions here.
rk325
Posts: 23
Joined: Mon Mar 27, 2023 6:02 pm

How to programmatically open and refresh browser

Post by rk325 » Mon Mar 27, 2023 6:33 pm

Hi, I am new to Ranorex writing code for tests , NOT RECORDING.

I need to do 2 things:
  • Open chrome on the indicated URL
  • Refresh that page to continue to the next test
To open I am using: Host.Local.OpenBrowser(URL, "chrome");
But nothing happens. I even closed all my chrome windows, and opened one pointing to google.com

I don't know how to send CTRL-F5 to the Dom to refresh this page, if I get to open it.
Please any help would be appreciated.

csaszi89
Posts: 41
Joined: Mon Jan 17, 2022 12:10 pm

Re: How to programmatically open and refresh browser

Post by csaszi89 » Tue Mar 28, 2023 10:19 am

Hi,
for refreshing the browser, you can call ExecuteScript on your dom element.

Code: Select all

webdocument.ExecuteScript("location.reload();");
This is the easiest way to reload a page.
But I am not sure why OpenBrowser is not working.
Dummy questions, but Chrome is installed properly? Try to reinstall. Try to instrument again.

rk325
Posts: 23
Joined: Mon Mar 27, 2023 6:02 pm

Re: How to programmatically open and refresh browser

Post by rk325 » Wed Mar 29, 2023 9:49 pm

Thank you, that reload works.
Host.Local.OpenBrowser(...) is also working as expected.