I want to perform mouse click on blank area outside a form in order to wake up the data traffic in some website by Selenium IDE. Any ideas?
I've tried to do click by x,y but it doesn't effective for my test case. The scenario is below:
The first step here would be to locate the main menu (AKA parent menu). Once that is done, the second step is to locate the desired element (child element) from the available options in the sub-menu. The final step would be to click on that child element.
Alternative of click() in Selenium We can use the JavaScript Executor to perform a click action. Selenium can execute JavaScript commands with the help of the executeScript method. The parameters – arguments[0]. click() and locator of the element on which the click is to be performed are passed to this method.
In order to perform the right click action we will use contextClick () method. First we need to move to the specific element with the help of moveToElement() method then will do the right click with contextClick() method. Finally use build(). perform() to execute all the steps.
You can use the command:
driver.findElement(By.xpath("//html")).click();
But sometimes it doesnt take blank spaces,
In such cases, use:
driver.get("//html");
The best solution is to just use the keyboard TAB
key by executing the following statement.
element.sendKeys(Keys.TAB);
It will focus the next element - thus out of the field - and you will get your desired result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With