Open GoogleCodeExporter opened 9 years ago
Can you provide an example of what you are trying to achieve?
If it's just to clear the windows clipboard, you can use the toClipboad command
:
Dim driver As New SeleniumWrapper.WebDriver
driver.Start "firefox", "http://www.google.com"
driver.Open "/"
...
driver.toClipboad ""
Original comment by florentbr
on 15 Jan 2014 at 4:08
Original comment by florentbr
on 15 Jan 2014 at 4:09
Sub Gamespot()
Dim driver As New SeleniumWrapper.WebDriver
Dim shell: Set shell = CreateObject("WScript.Shell")
'I tab over to a combo text calendar widget , Because I cant find the elements name
shell.SendKeys "{TAB 22}"
'I select the date i manually right down cell B1 to copy and paste in the combotext calender widget. This works great.
Sheets("Sheet1").Select
Application.CutCopyMode = False
Application.Sheets("Sheet1").Range("B1").Copy
shell.SendKeys "^v"
driver.Wait 1000
'But when I try this same method over again exception being cell D1. It paste's the same as B1, which was copied previously.
Sheets("Sheet1").Select
Application.CutCopyMode = False
Application.Sheets("Sheet1").Range("D1").Copy
shell.SendKeys "{TAB 2}"
shell.SendKeys "^v"
'I did go on to notice that after this ran threw it was on the correct range "D1" and it was highlighted that it was copied and if selected another cell in excel and pasted it would do the correct value. But if I were to click back into the same driver web page to paste it would paste what was previously pasted in the B1 Cell
I am curious if i could clear the clip board in driver before i copy my D1
cell. If that would do the fix. I also wouldn't know how to do that, if you
could walk me threw or if there are any other alternatives id be happy to hear.
Original comment by CodyLeeG...@gmail.com
on 16 Jan 2014 at 6:28
I wouldn't recommend to use the WScript.Shell to emulate the keyboard as it's
not attached to the browser.
There's multiple ways to select a page element, like by id or with a Css
selector and you can easily paste some text using the webdriver:
Dim driver As New SeleniumWrapper.WebDriver
Dim Keys As New SeleniumWrapper.Keys
driver.SendKeys String(22, Keys.Tab)
driver.toClipBoard Application.Sheets("Sheet1").Range("B1").Text
driver.Wait 500
driver.SendKeys Keys.Control & "v"
driver.Wait 500
...
I think you case is a timing issue. The cell text must still be on its way to
the clipboard while you are trying to past it.
Try to had a wait command before sending the Ctrl+v.
Original comment by florentbr
on 16 Jan 2014 at 10:15
I got it to work with your advice where could i go to read more about Css. I
seem to have problems plugging in data into DateTimePicker and ComboBox'es.
Original comment by CodyLeeG...@gmail.com
on 17 Jan 2014 at 1:20
Here is some examples on Css locators :
http://www.natontesting.com/2011/09/24/css-locator-referencecheat-sheet-for-xpat
h-people/
http://software-testing-tutorials-automation.blogspot.co.uk/2013/06/selenium-css
-locators-tutorial-with.html
You can also select the Css in Selenium IDE once the action has been recorded
and test some other by clicking on "Find"
The Selenium 1 format is :
driver.click "css=selector"
driver.type "css=selector", "text"
...
The Selenium 2 format is :
set ele = driver.findElementByCssSelector("selector")
ele.click
ele.sendKeys "text"
Original comment by florentbr
on 17 Jan 2014 at 9:47
Original comment by florentbr
on 8 Sep 2014 at 5:40
Original issue reported on code.google.com by
CodyLeeG...@gmail.com
on 14 Jan 2014 at 10:57