Selenium VBA - How Can I Read UserInput Data Triggered by JavaScript Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ต.ค. 2024

ความคิดเห็น • 14

  • @farshidfardnian3326
    @farshidfardnian3326 4 หลายเดือนก่อน

    How can I use the js code in the first of video for captcha?

  • @shaileshsharma668
    @shaileshsharma668 6 หลายเดือนก่อน

    I have question
    I want to interact with the web application which page is already open by manual

    • @practicalit91
      @practicalit91  6 หลายเดือนก่อน

      Research is still on

  • @practicalit91
    @practicalit91  6 หลายเดือนก่อน

    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

  • @tpdakc7904
    @tpdakc7904 6 หลายเดือนก่อน

    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

  • @PraveenKumar-il8kn
    @PraveenKumar-il8kn 3 หลายเดือนก่อน

    Are you providing VBA trainings?

    • @practicalit91
      @practicalit91  3 หลายเดือนก่อน

      @@PraveenKumar-il8kn what you are looking in vba?

    • @PraveenKumar-il8kn
      @PraveenKumar-il8kn 3 หลายเดือนก่อน

      @@practicalit91
      Advanced topics and
      Web automation

    • @practicalit91
      @practicalit91  3 หลายเดือนก่อน

      @@PraveenKumar-il8kn I can help in your projects instead

    • @PraveenKumar-il8kn
      @PraveenKumar-il8kn 3 หลายเดือนก่อน

      Hi Sir,
      I need to know how to handle
      Add sensitivity label in excel.

    • @MinatiBosu
      @MinatiBosu 3 หลายเดือนก่อน

      I want to contact me for captcha bypass and auo fill Please provide your contact number.

  • @dineshpanihar5863
    @dineshpanihar5863 5 หลายเดือนก่อน

    ₹2065 please help to scrap the price