How to Copy a cell/range of cells and paste On that webPage selenium vba

Viewed 31

I am trying to copy a range of cells to the clipboard and paste, there is a specific reason why I need to copy and paste.

Global bot As New ChromeDriver, post As Object
Public MyElement As selenium.WebElement
Public Keys As selenium.Keys

Sub copyPasteintoGoogleSearchBar()
  
 Set Keys = CreateObject("Selenium.Keys")
  
    loginAndGoToTesting
    
    With bot
        Range("A2:L5").Copy
        .FindElementByName("q").SendKeys (Keys.Control + "a" + "v")   
    End With
End Sub

Function loginAndGoToTesting()

With bot
    .Timeouts.ImplicitWait = 1000
   ' .AddArgument "--headless"
    .Start
    .get "https://www.google.com/"
    bot.Window.SetSize 2000, 1200
    bot.Window.Maximize
    bot.Refresh
End With
End Function

It will act like it is doing something and then nothing. If you manually right click on the url(not seeing a way to clickContext with selenium on the Url) before sending keys of ctrl and v it will paste in. rick click(click context) on the google search bar does not change the result of it not pasting.

0 Answers
Related