I have a popup screen (see attached image). I am using selenide which is a fantastic wrapper api of selenium. Can someone tell me how selenide focuses and interacts with such window popups.
I was able to get this to work. It was an Iframe and by using
driver.switchTo().frame("IFrameID/name") to interact with the popup window
To Go back to the main frame
driver.switchTo().defaultContent()
Related
My problem is when I click on a desktop icon, it opens a link in already opened chrome browser in a new tab. How do I attach with the already opened browser and not a new one?
The below code returns a null because there is no window opened through selenium ofcourse, so yeah.
Set<String> windows = webdriver.getWindowHandles();
System.out.println(windows);
Any suggestions would be of great help. Thanks In advance.
There is no way to attach the chrome window that you've opened from the desktop application to your WebDriver instance.
If you want to be able to control a web page with a Selenium - you must pass your URL to a driver like that:
webdriver.get("https://www.your_link.com");
You might think about the way of getting and storing your URL as a variable and passing it into your code.
That would also be helpful if you add a bit more details about the problem. It's a bit unclear at what stage of the test you open the web page with a desktop application. Selenium can't be used to test desktop applications. Code sample of the test from your project would also help.
I'm working on a some automation work, as per my requirement I need to click on Chrome Physical buttons like left nav, right nav, bookmarks, menu etc. I can do with shortcuts but my requirement is to click on browser buttons. Any ideas would be helpful. Thanks in advance.
As per your question you want to click on Chrome Physical buttons like left navigation, right navigation, bookmarks, menu etc.
But if you look into the documentation in Selenium Home Page it clearly mentions that :
The entire suite of tools provided by Selenium results in a rich set of testing functions specifically geared to the needs of testing of web applications. These operations allow many options for locating UI elements and comparing expected test results against actual application behavior.
So factually Selenium by design interacts with the HTML DOM and the WebElements located in the DOM Tree
Now the desired controls e.g. left navigation, right navigation, bookmarks, menu are out of the DOM. Hence you cannot mock the click on those controls.
However all the Selenium Language Binding Art provides a handfull of methods to achieve the same result. Here are a few from the Selenium Python Binding Art :
Maximize : To maximize the browser window.
driver.maximize_window()
Minimize : To minimize the browser window.
driver.minimize_window()
Close : To close the browser window.
driver.close()
Quit : To close the browser window gracefully.
driver.quit()
Refresh : To refresh the url.
driver.refresh()
Forward : To move forward.
driver.forward()
Back : To move backwards.
driver.back()
And of-coarse Get : To invoke an url.
driver.get('http://google.com/')
There are functions for this that is built-in:
driver.forward()
driver.back()
https://selenium-python.readthedocs.io/navigating.html#navigation-history-and-location
It doesn't appear that selenium can interact with the Bookmark, but let me check some more.
This can't be done with selenium webdriver and I think also not with the standalone selenium server. Selenium only allows to interact with the DOM.
The only way to achieve what you want to do is to use an automation tool that actually runs directly in the OS that you use. Java can be used to write such a program.
I would however recommend to not go this route. Instead try to convince whoever is responsible for your requirements to re-think and allow to use other means of achieving back and forward actions.
I am trying to build a ui that is similar to Tab Switcher in Chrome for Android(see attached image).
I tried StackView, but it was not what I want since it doesn't scroll like tab switcher in chrome.
Does Anyone know any way to implement this UI?
thanks.
You can make a Tab Switcher from this Library
https://github.com/michael-rapp/ChromeLikeTabSwitcher
This library provides a very easy method to do almost everything a chrome browser does.
When I click on one button, it goes to another screen and one new popup window appeared. I don't know how to close. Can any one help me out this? Im using Eclipse for writing code.
If the child window is a HTML window then you can close the window by using driver.close() syntax. Here assume driver is instantiated properly.
If it is a Native or OS window then it is not possible to handle it through selenium.
I understand that WebDriver cannot interact with dialogs, but since Sikuli compares images to interact is it possible to interact with file dialogs using SikuliFireFoxDriver?
Looking at http://code.google.com/p/sikuli-api/wiki/SikuliWebDriver, it seems to be possible to click on file dialog.
If above doesn't work for you, I would recommend you to go through:
http://romankukla.blogspot.in/2012/11/how-to-use-sikuli-script-with-selenium.html
I never used SikuliDriver but worked on the Sikuli Java API. Coming to your query, Sikuli works on anything visible on the screen. If it is visible then yes you can interact with SikuliDriver.