Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate mouse click on blank area in website by Selenium IDE?

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:

  1. fill the email field
  2. click outside the form in order to make the client to send data request to the server for check if this email is already exist in the DB and then it does auto complete and enable the continue button.
like image 530
Idan E Avatar asked Jan 15 '15 14:01

Idan E


People also ask

How do you use mouse over on the web element on page in Selenium?

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.

What is alternative for click in Selenium?

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.

How would you simulate the right click operation in WebDriver?

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.


2 Answers

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");
like image 117
Manu Singh Avatar answered Oct 13 '22 22:10

Manu Singh


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.

like image 27
Usman Kokab Avatar answered Oct 13 '22 21:10

Usman Kokab