Home > Software engineering >  Findelement "Run-time error '32' "Compound Class names not permitted"
Findelement "Run-time error '32' "Compound Class names not permitted"

Time:09-14

I am hoping you all can assist me. What I am trying to do is create a macro in Excel to automatically run a program my company to compare mortgage insurance from various companies we work with. I at a point where I need to hit a "Submit" button to get the mortgage insurance amounts. But instead, the program I use just stalls at this screen, instead of "auto-clicking" to the next screen

This is what the code looks like -

<button  pbutton="" type="submit"><span >Order Quotes</span></button>
  <span >Order Quotes</span>

The part that says "" I know is the key to this. But the area above it also has something to do with it because when I hover over the button, there are two ways the button is "emphasized". The top codes darkens the whole button. Where as the bottom code only highlights the wording inside the button.

I have tried the following code(s)

Driver.FindElementsByClass("ui-button-text ui-clickable").Click

What I get is a "Run-time error '32' message saying "Compound Class names not permitted"

Driver.FindElementsByClass("full-width ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only").Click

I get the same "Run-time error '32'message as above. Just can't figure out what the issue is and I have other items in this program with a ".click" after the line and it works fine. Just can't get this one.

What am I missing? BTW, I am self-taught with a few online classes. So, in no way an expert. Thanks for your help. Dave

CodePudding user response:

Run-time error '32' message saying "Compound Class names not permitted the error suggested that FindElementsByClass() doesn't support multiple class names it supports only class name

You can either pass single class only in FindElementsByClass() or use FindElementByCss() or FindElementByXPath()

Option 1:

 Driver.FindElementsByClass("ui-button-text").Click

Option 2:

 Driver.FindElementByCss(".ui-button-text.ui-clickable").Click

Option 3:

Driver.FindElementByXPath("//span[text()='Order Quotes']").Click
  • Related