Skip to content

Support switching windows and getting some window information on browsers without javascript#788

Merged
aaltat merged 2 commits intorobotframework:masterfrom
davidshepherd7:master
Apr 5, 2017
Merged

Support switching windows and getting some window information on browsers without javascript#788
aaltat merged 2 commits intorobotframework:masterfrom
davidshepherd7:master

Conversation

@davidshepherd7
Copy link
Contributor

I'm using this library with QtWebDriver to test Qt applications. Some of the windows in my application are not actually web-based, so they don't support the execute_script command. Currently this makes it impossible to switch between windows because a script is used to get the window title and url.

By using the web driver API instead of a custom execute_script we can implement the same functionality without javascript.

"return [ window.id, window.name, document.title, document.URL ];")
try:
id_, name = browser.execute_script("return [ window.id, window.name ];")
except WebDriverException:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is the exception type raised, it would be nice if it was something more specific.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's alright. At least it indicates that some sort of selenium error did happen and it is, in this case, OK to suppress the error.

@davidshepherd7
Copy link
Contributor Author

It doesn't look like those failing tests have anything to do with my changes.

@aaltat
Copy link
Contributor

aaltat commented Apr 3, 2017

Write an issue where you explain the problem you are having, It also helps maintainers to keep track of the changes.

By a quick look from a mobile screen, PR looks OK. But I have to give it a closer look from the mobile screen.

The test did stuck for some unknown reason and it happens sometimes in the Travis. I did rerun test and let's see the results.

@davidshepherd7
Copy link
Contributor Author

Hi, I created an issue for it.

It looks like the remaining test failure is a false positive (all the recent builds seem to have the same failure for the same reason).

@aaltat
Copy link
Contributor

aaltat commented Apr 5, 2017

Thank you. Yes the Python 3 support is not ready and therefore one of the CI jobs fail.

"return [ window.id, window.name, document.title, document.URL ];")
try:
id_, name = browser.execute_script("return [ window.id, window.name ];")
except WebDriverException:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's alright. At least it indicates that some sort of selenium error did happen and it is, in this case, OK to suppress the error.

@aaltat aaltat merged commit 76c86ce into robotframework:master Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants