0

I can't get to an element present on an HTML page with a Selenium command. I tried everything: find with Class, Id and CSS, but nothing works. Maybe with the Path search method, but not knowing it, I can't formulate it. Can anyone help me?

This is the HTML:

<input type="text" name="search" value="" placeholder="Cerca per prodotto" class="form-control input-lg searchInputHeader"> 
    

I expect to be able to enter a value located on an Excel sheet in the search field on the HTML page, using the .SendKeys instruction.

For example:

.FindElementsByClass("form-control input-lg searchInputHeader").SendKeys Cells(4, VbaPosizione) 

but doesnt'work.

DecimalTurn
  • 3,243
  • 3
  • 16
  • 36

1 Answers1

0

It looks like you are running into the "Compound class names not permitted error". This means that FindElementsByClass only accepts one class name.

If you want to select an element using multiple class names, you could to use a CSS selector like this (with a dot as prefix and no space between the different class names):

.FindElementByCss(".form-control.input-lg.searchInputHeader")

Also, a good pratice to debug you code is to split the step in multiple lines. For instance you could do the Selection and SendKeys seperatly:

    Dim MyInput As WebElement
    Set MyInput = MyWebDriver.FindElementByCss(".form-control.input-lg.searchInputHeader")
    MyInput.SendKeys "Some text"
DecimalTurn
  • 3,243
  • 3
  • 16
  • 36