1

I need some help. Chrome (v 75.0.3770.100) using Selenium Basic ChromeDriver (v 75.0.3770.140) in Excel (2013) VBE. There's an input box which generates a dynamic list if the customer id# exists. I wish to fill in the customer id# then select from the dynamic drop down. But first step, I'm struggling to input my text to the box. I'm able to click on the box with

obj.FindElementById("selectcustTxt").Click

but when I try to fill in the box with:

obj.FindElementById("selectcustTxt").Value = "1111"

I get an error Run-time error '424': Object required

I tried the following FindElementByXPath with both .Value and .Text but get the same Run-time error '424': Object required

obj.FindElementByXPath("//input[@class='form-control cust-autosuggest ng-pristine ng-valid ng-touched'][@id='selectcustTxt']").Value = "1111"

Here's the HTML:

<div class="form-group search-field"><input id="selectcustTxt" type="text" class="form-control cust-autosuggest ng-valid ng-touched ng-dirty ng-valid-parse" autocomplete="off" plshholder="Enter Cust name" autocomplepte="off" ng-model="cust" suggest-type="custService" sh-autosuggest="custAddresses" data-validation="required">
DebanjanB
  • 118,661
  • 30
  • 168
  • 217
DWP
  • 103
  • 1
  • 8

1 Answers1

2

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

  • Using FindElementByCss:

    obj.FindElementByCss("input.form-control.cust-autosuggest.ng-valid.ng-touched.ng-dirty.ng-valid-parse#selectcustTxt").SendKeys ("1111")
    
  • Using FindElementByXPath:

    obj.FindElementByXPath("//input[@class='form-control cust-autosuggest ng-valid ng-touched ng-dirty ng-valid-parse' and @id='selectcustTxt']").SendKeys ("1111")
    

Reference

You can find a couple of relevant discussions in:

DebanjanB
  • 118,661
  • 30
  • 168
  • 217