Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing keyboard keys (Esc, Enter) #22

Open
GoogleCodeExporter opened this issue Mar 31, 2015 · 4 comments
Open

Pressing keyboard keys (Esc, Enter) #22

GoogleCodeExporter opened this issue Mar 31, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

Operating system : Win7
.Net Framework version : 2.0.7045
Office Version : 2003
SeleniumWrapper version : 1.0.11.0

Please could you provide sample VBA code, that will simulate physically 
pressing keyboard keys (ESc, Enter) and possibly also instruction how other 
keys can be pressed.

Original issue reported on code.google.com by [email protected] on 6 May 2013 at 8:30

@GoogleCodeExporter
Copy link
Author

There you go :

Dim selenium As New SeleniumWrapper.WebDriver
Dim Keys As New SeleniumWrapper.Keys
selenium.Start "firefox", "http://www.google.com"
selenium.Open "search?q=eiffel+tower"

selenium.SendKeys Chr(9) // ascii code for escape
Or
selenium.SendKeys Keys.Escape  // Send escape to the active element
Or
selenium.findElementById("id").SendKeys Keys.Enter  'Send enter to the element

Original comment by florentbr on 6 May 2013 at 12:53

  • Changed state: Accepted
  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

To close a windows popup, you first have to to use the switchToWindow command.
Then you can try to send the escape key :

selenium.switchToWindow "windows-name"
selenium.sendKeys Keys.Escape

For the "id=x-auto-32", you can use a CSS selector with partial id :
selenium.findElementByCssSelector("a[id^=x-auto-]").click

Original comment by florentbr on 10 Jul 2013 at 11:00

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Original comment by florentbr on 8 Sep 2014 at 5:40

  • Changed state: Done
  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant