问题
When I use Firefox browser then the window is on top, but for Chrome it is not. So, how can I make Chrome window be on top?
I have seen the selenium2library\keyword\_browsermanagement.py
, but can't find any useful keyword(s).
回答1:
Have you tried the Get Window Identifiers, Get Window Names, Get Window Titles, List Windows keywords available in the Selenium2Library? If you've success with one of them, you should them be able to Select Window and bring it to the forefront.
We could use a bit more context in your question, do you have multiple browsers open at once? If so, why?
回答2:
Found the solution worked for our project. Before driver.get(url) we execute the following command:
osascript -e tell application "${browserName}"
activate
delay 1
end tell
browserName could be safari/chrome/firefox
来源:https://stackoverflow.com/questions/38197800/how-to-make-chrome-display-on-the-top-opened-in-selenium-mac-os-x