Comments (7)
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
- Changed state: Accepted
from selenium-vba.
Original comment by florentbr
on 15 Jan 2014 at 4:09
- Added labels: Type-Support
- Removed labels: Type-Defect
from selenium-vba.
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 [email protected]
on 16 Jan 2014 at 6:28
from selenium-vba.
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
from selenium-vba.
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 [email protected]
on 17 Jan 2014 at 1:20
from selenium-vba.
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
from selenium-vba.
Original comment by florentbr
on 8 Sep 2014 at 5:40
- Changed state: Done
from selenium-vba.
Related Issues (20)
- how to get innertext or textcontent with selenium HOT 2
- extract product data from web HOT 7
- Unable to open the URLs in the excel file using chrome HOT 4
- Unable to use chrome browser to work HOT 6
- Method <type> failed HOT 2
- Selenium user session cookies HOT 1
- Set HTMLDOC = driver.Document Here I would like to know the source for the Document. HOT 1
- how to scroll down till element is visible HOT 2
- Click item "a" and "href =" HOT 3
- how to identify if page has scrollbar, using Selenium VBA HOT 2
- how to send user credentials through VBA selenium HOT 4
- The execution is getting slower. HOT 1
- How to click button with no ID, Name or Value HOT 2
- How to set a profile in VBA (excel) HOT 2
- Compatability With Firefox 36 HOT 4
- Selenium VB.net "NuGet Package" HOT 3
- Can not switch frames HOT 2
- Find correct Element with Different Elements Having same ID HOT 1
- Update to 2.45 HOT 1
- Click failed (id=xxxx not found) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from selenium-vba.