1

How would I use the web driver to find an element that is a sort of submenu like this code below. I have tried finding it by its class name like this

driver = new ChromeDriver(@"C:\chromedriver_win32");
driver.FindElement(By.ClassName("{img: '16-member-remove.png")).Click();

And that hasn't worked. if you need any more info just ask, thanks.

This is the buttons html code

<a
    href="javascript:setMenuId('EmployViewMenu', '0', 'b532931583354d4890fbd6884835760e', 'EmployViewMenu_MenuIdHiddenField', '1', 'EmployViewMenu_PostbackButton');"
    class="{img: '16-member-remove.png'}"
    tabindex="0"
    img="16-member-remove.png">
    New Client
</a>

1 Answer 1

1

That's a horrible class name to have and base your locator on. Just get the element by link text:

driver.FindElement(By.LinkText("New Client"));
driver.FindElement(By.PartialLinkText("New Client"));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.