Sunday, February 19, 2017

Lesson #12 - Finding element using the Class Name attribute (C#)

You can use the class name to find attributes in the following way.

Code Example
To locate the contact form user name field, we will now use the class attribute:
<input type="text" value="" size="30" name="name" id="ContactForm1_contact-form-name" class="contact-form-name">

public void FindElementByClassName()
IWebElement WebElement;
IWebDriver Firefox = new FirefoxDriver();
WebElement = Firefox.FindElement(By.ClassName("contact-form-name"));


No comments:

Post a Comment

My Presentations