VBA Selenium Paste cell in Web Browser

OldGreg

New Member
Joined
Jan 1, 2014
Messages
17
Code:
Sub Gamespot()Dim driver As New SeleniumWrapper.WebDriverDim shell: Set shell = CreateObject("WScript.Shell")	'I tab over to a combo text calendar widget , Because I cant find the 'elements nameshell.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").SelectApplication.CutCopyMode = FalseApplication.Sheets("Sheet1").Range("B1").Copyshell.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").SelectApplication.CutCopyMode = FalseApplication.Sheets("Sheet1").Range("D1").Copyshell.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.</pre>
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

OldGreg

New Member
Joined
Jan 1, 2014
Messages
17
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.
</pre>
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,123,493
Messages
5,601,998
Members
414,490
Latest member
Rip181

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top