Q: Selenium Webdriver (Java) , Need to send "Space" keypress to the website as whole My problem is as follows. 
I am attempting to automate part of a test suite for a website I work in, and while most of it went well, I'm at the point where the developers added a lightbox to confirm the next action. 
Using firebug I found out an xpath I could use to click the button I need to proceed, but sadly it isn't working. 
After some manual attempts, I figured that pressing the "Space" key, I can proceed. 
The problem is that any sort of try using "driver.findElement" be it by xpath, or link text, fails with a "No such element" error in console.
So I'm trying to just send the keypress of Space , without using find element. 
To be clear, I want to emulate someone just pressing space without clicking or selecting anything beforehand. 
I tried with driver.Keyboard... but "Keyboard" isn't recognized, so I'm at a loss of how to send this keypress without using driver.findElement.
The piece of code giving me problems is:
driver.findElement(By.xpath("//div[4]/div[3]/div/button")).click();

Any help would be appreciated. 
Thank you and have a great day!

A: If you receive NoSuchElementException, but you know that the element is there, then it seems that the element get loaded into the DOM later (with ajax?), than the page get loaded.
In this case you should use Implicit or Explicit Wait to wait until an element present, or an element is visible, etc...
If it still doesn't work, and you want to try the Space Key thing, then you can perform it on any element, for example on the <body> tag:
WebElement body = driver.findElement(By.tagName("body"));
body.sendKeys(Keys.SPACE);

Hope it helps.

A: try this: 
 Actions action = new Actions(Driver);
 action.SendKeys(Keys.Space).Build().Perform();

