0
<input type="button" class="action button" style="margin-left: 0px;" value="Tracking Code" onclick="SetTrackingCodeModal(JSON.parse(jQuery(this).closest('tr').attr('data-row')))">

When trying to inspect the button, I tried to inspect using class but it throws an error when running the test:

An exception of type 'OpenQA.Selenium.InvalidSelectorException' occurred in WebDriver.dll but was not handled in user code

Additional information: invalid selector: Compound class names not permitted

Following is the class where I am inspecting the element:

 private By TrackingCode_Button => By.ClassName("action button");

 public void method() {
 driver.FindElement(Tracking_Button).Click();
 }
Ishita Shah
  • 3,955
  • 2
  • 27
  • 51
Analyst
  • 105
  • 1
  • 9

2 Answers2

1

Try with :

 private By Tracking_Button => By.XPath("//input[@value='Tracking Code']");

 public void method() {
 driver.FindElement(Tracking_Button).Click();
 }
Ishita Shah
  • 3,955
  • 2
  • 27
  • 51
-1

Multiple classes case is solved by CssSelector and . separating class names

By.CssSelector(".action.button");

discussed here

Vladimir Efimov
  • 797
  • 5
  • 13