How to send text to some HTML elements through Selenium VBA?

前端 未结 1 822
野趣味
野趣味 2020-12-21 19:24

I have been having trouble on referring to a search box on a website through Selenium in VBA. The HTML code of the box is:



        
相关标签:
1条回答
  • 2020-12-21 20:02

    To send a character sequence within the desired element you can use either of the following Locator Strategies:

    • Using FindElementByCss:

      bot.FindElementByCss("input.form-control.input-sm[aria-controls='result_table']").SendKeys ("werresf")
      
    • Using FindElementByXPath:

      bot.FindElementByXPath("//input[@class='form-control input-sm' and @aria-controls='result_table']").SendKeys ("werresf")
      

    Reference

    You can find a couple of relevant discussions in:

    • Trying to fill text in input box with dynamic drop down
    • Need help to fill number into Chrome input box with Selenium
    0 讨论(0)
提交回复
热议问题