Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

404
Views
Selenium VBA using JS path to send text to web element

Using Selenium VBA Code using "JS PATH".

I have a problem with only this specific HTML, because it is structured in a way that makes entering text harder.

The HTML:
<textarea class="messenger-composer" placeholder="Say something…" style="height: 34px;">THE TEXT NEEDS TO GO HERE </textarea>

  ''Code1 with querySelector returns error ")" is missing:
    Dim Textw As String
    cScript = "document.querySelector('textarea[placeholder='Say something…']').innerHTML = '" & Textw & "'"
    bot.ExecuteScript cScript


  ''  Code2 with querySelector pastes the text in the wrong location making the HTML page corrupt.
      Dim Textw As String
      cScript = "document.querySelector('#main_content > div.notifications-footer.notifications-footer--collapsed > div.messenger > div.FullscreenOverlay-content > div > div > div > div > div > div > div.messenger-composer-wrapper ').innerHTML ='" & Textw & "'"
      bot.ExecuteScript cScript

enter image description here

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Dim Textw As String
    cScript = "document.getElementsByClassName('messenger-composer')[0].innerHTML = '" & Textw & "'"
    bot.ExecuteScript cScript
''send key is disabled, this workaround makes it enabled.
        bot.SendKeys "a"
        bot.SendKeys bot.Keys.Backspace
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!