How to handle this popup in selenium webdriver - selenium-webdriver

How to handle this popup in selenium webdriver
Actually it has only div id. no frame, window names. it's just a modal think.
Trying to click the buttons. But, unfortunately can't get focus of this
driver.findElement(By.xpath("/html/body/div[9]/div/div[2]/div[2]/div[1]/button")).getText();
driver.findElement(By.xpath("/html/body/div[9]/div/div[2]/div[2]/div[1]/button")).click();
Screenshot

Related

Opening Selenium Browser in a JavaFX WebView

I want to know if there is anyway I can open up the Selenium WebDriver in a WebView rather than the default behavior of opening in a new window. If not is there anyway I can get the same functionality (Being able to press buttons, and fill text fields) through the JavaFX WebView.

How to avoid blocking new window popup in AngularJS

I've an issue on opening new page window in my Angular JS project if popup is being blocked.
Do you have any solution on bypass popup/new window blocking in IE > 8
Note; It's not a button click event to open new window.
If you are referring to the window popup using window.open() you can't specially if the user has blocked popup's from their browser that popups blocked icon at the rightmost part of the url bar or in the browser settings then you can't do anything about it.

how to select radio button in twitter by selenium webdriver with python?

select radio button in twitter such as picture below by selenium webdriver with python?
If you open the developer tools of the twitter page, you can see that the dialog contains an iframe (id = "new-report-flow-frame"). You should first switch to that iframe before searching for a radio button
driver.switch_to.frame(driver.find_element_by_id("new-report-flow-frame"))
driver.find_element_by_css_selector("[value='illegal_product']")
You should first switch to popup window with something like
driver.switch_to_window(driver.window_handles[1])

Why Sikuli API not able to click Window image for the first time? Works when repeated.

When the file upload window opens, it doesn't click for first time. I close it manually then click again to open the dialog, this time Sikuli proceeds with execution.
Using selenium webdriver to automate file upload with Sikuli API. Please find below code:
driver.get("file:///C:/Users/nitin.chawda/Desktop/example1.html");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.id("usage")).click();
Screen screen = new Screen();
screen.wait("images\\location1.png",100).doubleClick();
screen.wait("images\\file1.png",100).click();
screen.wait("images\\open.png",100).click();
It's possible that your click is happening the first time, but not doing what you'd expect.
If the window you're trying to click is not in focus, then, rather than preforming some other action, the first click will focus that window, .
Try using the App.focus("WINDOW-NAME"); classmethod before the Sikuli clicks. (where "WINDOW-NAME" is a string matching the name of your file upload window)
Resources:
App Class from Sikuli docs
App Class from the javadoc
just use screen.click(), it will enable the window focused.

Unable to click on Menu Bar>>Tools Menu in Mozilla Firefox using Selenium Webdriver

How to click on Menu Bar>>Tools Menu of Mozilla Firefox using selenium Webdriver?
You CAN'T do something like this. You just can handle the HTML elements, events and simulate actions between your HTML and the user. Selenium works with the DOM, is used to test your web application not to interact with the browser as OS an app.
You can use the following code:
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
And then use the right arrow to move from one element to another.

Resources