Kamal
Kamal

Reputation: 303

Case sensitive in Selenium WebDriver

I am writing test case in c# using selenium webdriver.

I have got one Id of button which is "ShowReports" and used that Id to click that button. It is working fine.

First I have mentioned that ID name as "showreports" and not able to click that button. After I have mentioned that exact Id name which is available on the webpage, it is working fine.

Please let me know, Is the selenium webdriver case sensitive while using css, id elements and also let me know, how to avoid that case sensitive?

    [FindsBy(How = How.Id, Using = "ShowReports")]
    protected IWebElement ShowReportsButton = null;

Upvotes: 1

Views: 2207

Answers (2)

Ashish Narmen
Ashish Narmen

Reputation: 876

You could try using a case insensitive CSS selector like this and check

[FindsBy(How = How.CssSelector, Using = "input[id='showreports' i]")] 
private IWebElement CaseInsensitiveShowReportsButton;

Upvotes: 2

Guy
Guy

Reputation: 50809

Yes, Selenium is case sensitive.

No, you can't avoid it. Best way to handle this is to copy the names from the html instead of writing them yourself.

Upvotes: 0

Related Questions