엑셀 Range("K9:N" & lr) 의 자료를 클립보드에 복사 한 후, 웹사이트 ID "wmd-input" 에 붙여넣기
Sub Test()
Dim obj As New WebDriver
Dim Keys As New Selenium.Keys
Dim rng As Range
Set rng = Nothing
lr = Range("K" & Application.Rows.Count).End(xlUp).Row
Set rng = Range("K9:N" & lr).SpecialCells(xlCellTypeVisible)
obj.Start "chrome", ""
obj.Get "https://stackoverflow.com/questions/29348045/copy-from-excel-to-browser/"
obj.SetClipBoard [Range("K9:N" & lr)]
obj.FindElementById("wmd-input").SendKeys Keys.Control, "v"
End Sub
엑셀 Range("K11") 의 자료를 클립보드에 복사 한 후, 웹사이트 ID "wmd-input" 에 붙여넣기
Sub Test()
Dim obj As New WebDriver
Dim Keys As New Selenium.Keys
obj.Start "chrome", ""
obj.Get "https://stackoverflow.com/questions/29348045/copy-from-excel-to-browser/"
obj.SetClipBoard [K11]
obj.FindElementById("wmd-input").SendKeys Keys.Control, "v"
End Sub
셀 범위(A2:L2)를 클립보드에 복사하여 q에 붙여넣기기
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:L2").Copy
.FindElementByName("q").SendKeys (Keys.Control + "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
textarea 에 붙여 넣기
<div>
<div>
<textarea> id = "textarea1"
</textarea>
</div>
</div>
selenium.findElementByID("textarea1").sendkeys (keys.Control & "v")
selenium.findElementByID("textarea1").sendkeys keys.Control, "v"
selenium.findElementByID("textarea1").sendkeys (keys.Control +"v")
'SELENIUM > VBA' 카테고리의 다른 글
| Get/Post 요청 보내기 (0) | 2023.12.09 |
|---|---|
| Chrome에서 자동 테스트 소프트웨어에 의해 제어되는 숨기기 (0) | 2023.12.09 |
| 디지털배움터 반자동 회원가입(selenium) (0) | 2023.12.09 |
| 크롬/엣지 드라이버 시작 (0) | 2023.12.09 |
| 셀레니움(selenium) 설치 및 예제 (0) | 2023.12.09 |