How to make chrome display on the top opened in selenium [Mac OS X]

你说的曾经没有我的故事 提交于 2019-12-08 02:27:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!