danwagnerco / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
1 stars 0 forks source link

SendKeys with Chrome Browser VBA #50

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Operating system : Windows 7
.Net Framework version :
Office Version : 2010
SeleniumWrapper version : latest one

Browser name and version : chrome 32.0.1700.102 m
SeleniumWrapper version : 1.0.17
ChromeDriver: 2.9

The problem:

Run code below on vba in Excel 2010

Public Sub newtab()
  Dim driver As New SeleniumWrapper.WebDriver
  Dim Waiter As New Waiter
  Dim keys As New SeleniumWrapper.keys

  driver.Start "chrome", "http://www.w3schools.com/"
  driver.Open "/"
  Waiter.Timeout = 60000

  driver.SendKeys keys.Control, keys.Tab
  driver.Open "/web/default.asp"

  driver.SendKeys keys.Control, keys.Tab
  driver.Open "/web/web_css.asp"

  driver.Stop

End Sub

The chrome browser should open 2 new tabs and access the url's on each one of 
them.

But Chrome ignores SendKeys commands and access all url's in the same tab, one 
after one until the end.

This same code works perfectly in Firefox.

Anyone, how to solve that ? 

I really need to use Chrome.

Original issue reported on code.google.com by fhilip...@gmail.com on 3 Feb 2014 at 6:25

GoogleCodeExporter commented 9 years ago
One mistake on my code. 

Instead of "keys.tab" replace to "t".

driver.SendKeys keys.Control, "t"

Original comment by fhilip...@gmail.com on 3 Feb 2014 at 7:32

GoogleCodeExporter commented 9 years ago
It's not currently possible. This issue was reported on the Selenium project 
which this wrapper rely on 
(http://code.google.com/p/chromedriver/issues/detail?id=572).
Another way would be to open a new window :
driver.executeScript "window.open()"

Original comment by florentbr on 4 Feb 2014 at 1:31

GoogleCodeExporter commented 9 years ago

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