Reputation: 51
I am trying to stimulate the control+v option in a text box in chrome using selenium vba wrapper. I tried using the context click but that function seems to click at a random position based on the cursor position. I tried using the send key function but i am not getting the desired result.
selenium.SendKeys (key.Control & "v")
Please any advise or leads would be much appreciated.
Upvotes: 1
Views: 3802
Reputation: 84465
You want to target the text box before using sendkeys. Let's say, hypothetically, that there is an ID called textbox1 for identifying the element then:
driver.FindElementById("textbox1").SendKeys("yourString")
Or
driver.FindElementById("textbox1").SendKeys Keys.Control, "v"
The latter assuming info is already in the clipboard with, for example, driver.SetClipBoard "yourString"
Upvotes: 3
Reputation: 66
I think you'll be better off using a variable to hold your data rather than the clipboard. Then you can use sendkeys to type it in:
myData= "your data here"
selenium.sendkeys myData
hth
Upvotes: 0