How to simulate a mouse click on an empty area on the Selenium IDE website?

I want to click on an empty area outside the form to wake up data traffic on some Selenium IDE site. Any ideas?

I tried to click on x, y, but this is not effective for my test case. The following is the scenario:

  • fill in the email field
  • click outside the form so that the client sends a data request to the server to check if this letter exists in the database, and then it automatically completes and includes a continue button.
+9
source share
6 answers

You can use the command:

driver.findElement(By.xpath("//html")).click(); 

But sometimes he doesn’t accept spaces

In such cases, use:

 driver.get("//html"); 
+6
source

Just click on another element on the page that you are sure is present.

 Browser.Driver.FindElement(By.Id("testtest123")).Click(); 

Another solution might be to call javascript to remove focus from this email field, it depends on the trigger that you set to run ajax.

+1
source

"html" is a special element, what you want is a "body" (the first visible DOM element)

so please use the following (tested with Chrome, make sure it works without problems):

Python example driver.find_element_by_xpath("//body").click()

+1
source

I hope this can still help people, so I have the answer =) Selenium always throws exceptions by a simple click, if a drop-down list, field or something else makes other buttons inactive. The way out for me was to use pause actions. Here are a few lines of code from my example:

 Actions actions = new Actions(driver); actions.moveToElement(driver.findElement(By.xpath("your path"))) .click().pause('your amount of milliseconds').click().build().perform(); 

Wrap this in some kind of function, and that’s it, you have a new clicker.

0
source

The best solution is to simply use the TAB keyboard by following the instructions below.

 element.sendKeys(Keys.TAB); 

He will focus the next element - thus, outside the field - and you will get the desired result.

0
source

After filling in the email, use this command to click the blank area.

driver.findElement (By.xpath ("// HTML")) press () ;.

He will click an empty area.

-1
source

Source: https://habr.com/ru/post/1211166/


All Articles