0

I tried to click 'Sign In' button. but It doesn't click at all. my code is below. Can anybody help me?

[FindsBy(How = How.XPath, Using = "//input[@name='ctl00$MainContent$LoginForm$LoginButton' and @value='sign in']")]
    [CacheLookup]
    private IWebElement Submit { get; set; }

    public LoginPage(IWebDriver driver)
    {
        this.driver = driver;
        PageFactory.InitElements(driver, this);
    }

    public void LoginToApplication()
    {
        System.Threading.Thread.Sleep(5000);
        Submit.Click();
     }

enter image description here

1
  • Please post the HTML as text instead of an image. Commented Mar 27, 2017 at 9:21

1 Answer 1

2

Try any of these below mentioned xpath.

//button[text()='sign in']

Explanation:- Use text method along with <button> tag.

OR

//button[@class='color'][text()='sign in']

Explanation:- Use class attribute and text method along with <button> tag.

OR

//button[@type='button'][text()='sign in']

Explanation:- Use type attribute and text method along with <button> tag.

Suggestion:- Instead of using absolute xpath, use relative xpath.

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.