Confirm whether a website is open

I’m building a test case where I need to click on a button in a windows program and that will open a website in the browser. My goal is to confirm said website was opened.
I tried using Selenium for the test, however after some digging I understand that Selenium is only aware of browsers it opened itself.
I’ve attempted to bypass this issue by opening a browser with Selenium before I click the button, in the hopes the link will be opened in the new window, however when clicked it still opens it in a new tab in my normal use browser.
Another attempt I’ve made was to use RPA and try to read the value of the address bar and made sure it contains the right value, however for some reason it fails to see the locator (It is “name:Address and search bar”, no id or anything else I can use). This one might be due to the spaces in the name, however I don’t know how to bypass this one.

Is there a way to force the Selenium browser to be the one for links to open in, or to somehow get the RPA locator to work?
For now I made it take a screenshot, but I cant do much with it so I’m open to more suggestions I might’ve missed.

P.S posted it here as its more generic for any possible library, but not enough for the “RFW” category.

Hi,

I don’t know if create a new webdriver session will allow to attach the opened browser to it and then use selenium keywords. Maybe others have idea on this.

But if you can take a screenshot your can compare it to a ref with Doctest.VisualTest library.
This could be a solution if the site verification does not requires further page check, and doesn’t change too often.

Regards
Charlie

I did consider such a solution, however the screenshot will vary depending on the monitor resolution you have. This might become an issue if the tests were to run on a different computer than the one the ref picture was generated on.
Moreover, it may also cause an issue if something on the computer changes in any way (tabs, bookmarks, pinned icons on the bottom).
So I think this solution is a no go unfortunately.

OK, just for you to know, you can choose to resize candidate files for comparison to avoid screen size issues. And use masks to hide some parts of the screenshot (such as dates, fixed areas…)

Hopefully somebody will have a browser solution.

Regards
Charlie

1 Like