Dim CD As Selenium.ChromeDriver Sub JS_Example_2ndMethod() Set CD = New Selenium.ChromeDriver With CD .Get "" .Window.Maximize End With Dim jscode As String 'This line defines JavaScript code that prompts the user to enter their name using the window.prompt() method. jscode = "var userInput = window.prompt('Please enter your name:');" & vbCrLf 'This line appends JavaScript code to create a new element jscode = jscode & "var divElement = document.createElement('div');" & vbCrLf 'This line appends JavaScript code to set the id attribute of the element jscode = jscode & "divElement.id = 'userInputDiv';" & vbCrLf 'This line appends JavaScript code to create a text node containing the message jscode = jscode & "var textNode = document.createTextNode(userInput);" & vbCrLf 'This line appends JavaScript code to append the text node to the element. jscode = jscode & "divElement.appendChild(textNode);" & vbCrLf 'This line appends JavaScript code to append the element to the body of the document jscode = jscode & "document.body.appendChild(divElement);" 'execute javascript code CD.ExecuteScript jscode 'define variables for timeout and loop interval Dim timeoutsec As Integer timeoutsec = 50 Dim Millisec As Integer Millisec = 500 'wait for user input and loop Dim userinput As String Dim starttime As Double starttime = Timer Do 'check if the userimputdev element exists On Error Resume Next userinput = CD.FindElementById("userInputDiv").Text On Error GoTo 0 'if userinput is not empty or timeout is reached,exit loop If userinput "" Or Timer - starttime > timeoutsec Then Exit Do Application.Wait Now + TimeValue("0:00:01") Loop CD.Quit Msgbox userinput
In video VBA - Captcha Automation Part-2 (Selenium VBA). If captcha code is incorrect then how can i pop up again input box. Make video tutorial, please
How can I use the js code in the first of video for captcha?
I have question
I want to interact with the web application which page is already open by manual
Research is still on
Dim CD As Selenium.ChromeDriver
Sub JS_Example_2ndMethod()
Set CD = New Selenium.ChromeDriver
With CD
.Get ""
.Window.Maximize
End With
Dim jscode As String
'This line defines JavaScript code that prompts the user to enter their name using the window.prompt() method.
jscode = "var userInput = window.prompt('Please enter your name:');" & vbCrLf
'This line appends JavaScript code to create a new element
jscode = jscode & "var divElement = document.createElement('div');" & vbCrLf
'This line appends JavaScript code to set the id attribute of the element
jscode = jscode & "divElement.id = 'userInputDiv';" & vbCrLf
'This line appends JavaScript code to create a text node containing the message
jscode = jscode & "var textNode = document.createTextNode(userInput);" & vbCrLf
'This line appends JavaScript code to append the text node to the element.
jscode = jscode & "divElement.appendChild(textNode);" & vbCrLf
'This line appends JavaScript code to append the element to the body of the document
jscode = jscode & "document.body.appendChild(divElement);"
'execute javascript code
CD.ExecuteScript jscode
'define variables for timeout and loop interval
Dim timeoutsec As Integer
timeoutsec = 50
Dim Millisec As Integer
Millisec = 500
'wait for user input and loop
Dim userinput As String
Dim starttime As Double
starttime = Timer
Do
'check if the userimputdev element exists
On Error Resume Next
userinput = CD.FindElementById("userInputDiv").Text
On Error GoTo 0
'if userinput is not empty or timeout is reached,exit loop
If userinput "" Or Timer - starttime > timeoutsec Then Exit Do
Application.Wait Now + TimeValue("0:00:01")
Loop
CD.Quit
Msgbox userinput
End Sub
In video VBA - Captcha Automation Part-2 (Selenium VBA). If captcha code is incorrect then how can i pop up again input box. Make video tutorial, please
Are you providing VBA trainings?
@@PraveenKumar-il8kn what you are looking in vba?
@@practicalit91
Advanced topics and
Web automation
@@PraveenKumar-il8kn I can help in your projects instead
Hi Sir,
I need to know how to handle
Add sensitivity label in excel.
I want to contact me for captcha bypass and auo fill Please provide your contact number.
₹2065 please help to scrap the price
Which website?