C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
CSS Selector - Class
Let us consider an example on how to use class attribute to create a CSS Selector which uniquely identifies a web element. We will try to locate a web element by defining the CSS Selector for that particular web element.
Now, using second command we will try to locate the "Username" text box. First we will inspect the "Username" text box to get the value of its class attribute.
We will define the CSS Selector as: css=input.form-control
We will add one more command using the same CSS Selector. This command will type the username text into the "Username" text box.
Let us execute our test script to see whether our inserted commands are working or not.
The following screenshot shows that we have successfully executed our test script. (1) - Value of class attribute is used for both of our CSS Selector's to locate the "Username" text box element. (2) - Log pane displays the overall summary of the executed test script. (3) - Value generated as a result of execution of our third command.
Next TopicLocating by Attribute
|