Accessing Forms in Webdriver HTML
Accessing Forms in Webdriver HTML
Testing
SAP
Web
Live Projects
Accessing Form
Elements
Input Box
Must Learn!
Blog
Search
Search for...
SoapUI WebService
Testing
Attention Automation P
Selenium
Tutorials
1) Introduction
2) Install IDE &
FireBug
3) Introduction IDE
pdfcrowd.com
The clear() method is used to delete the text in an input box. This
method does not need any parameter. The code snippet below will
clear out the text "tutorial" in the User Name text box.
3) Introduction IDE
4) First Script
5) Locators
6) Enhancements
7) Intro WebDriver
Radio Button
Toggling a radio button on is done using the click() method.
8) Install
Webdriver
9) First WebDriver
Script
10) Forms &
Webdriver
11) Links & Tables
12) Keyboard
Mouse Events
Check Box
Toggling a check box on/off is also done using the click() method.
The code below will click on Facebook's "Keep me logged in" check
box twice and then output the result as TRUE when it is toggled on,
and FALSE if it is toggled off.
open in browser PRO version
pdfcrowd.com
Dependency
Links
Time Picker
25)Using Apache
Ant with Selenium
26) Tutorial on
Log4j and
LogExpert with
Selenium
27) Maven &
Jenkins with
Selenium:
Complete Tutorial
28)Selenium with
HTMLUnit Driver &
PhantomJS
29)Database
Testing using
Selenium: Step by
Step Guide
Drop-Down Box
open in browser PRO version
pdfcrowd.com
Feedback
Your Feedback &
Ideas are very
important to us.
Please share your
suggestions here
Step 1
Import the "Select" package.
pdfcrowd.com
Step 2
Declare the drop-down element as an instance of the Select class. In
the example below, we named this instance as "drpCountry".
Step 3
We can now start controlling "drpCountry" by using any of the available
Select methods. The sample code below will select the option
"ANTARCTICA".
pdfcrowd.com
The code below will select the first two options using the
selectByVisibleText() method.
pdfcrowd.com
Select Methods
The following are the most common methods used on drop-down
elements.
Method
selectByVisibleText() and
deselectByVisibleText()
Example:
open in browser PRO version
Description
Selects/deselects the option
that displays the text matching
the parameter.
Parameter: The exactly
displayed text of a particular
pdfcrowd.com
selectByIndex() and
deselectByIndex()
Example:
pdfcrowd.com
isMultiple()
Example:
deselectAll()
Example:
Submitting a Form
The submit() method is used to submit a form. This is an alternative
to clicking the form's submit button.
open in browser PRO version
pdfcrowd.com
You can use submit() on any element within the form, not just on the
submit button itself.
Summary
The table below summarizes the commands to access each type of
element discussed above.
Element
Command
Description
Input Box
sendKeys()
pdfcrowd.com
Input Box
sendKeys()
clear()
click()
Links
click()
Drop-Down
Box
selectByVisibleText()/
selects/deselects an option
by its displayed text
Check Box,
Radio
Button,
deselectByVisibleText()
selectByValue()/
deselectByValue()
selects/deselects an option
by the value of its "value"
attribute
pdfcrowd.com
selectByIndex()/
deselectByIndex()
Submit
Button
selects/deselects an option
by its index
isMultiple()
deselectAll()
submit()
pdfcrowd.com
Prev
Next
The Borgata
pdfcrowd.com
Borgata Casino
RealDose Nutrition
Brilliant Earth
Instant Checkmate
open in browser PRO version
pdfcrowd.com
4 Comments
Guru99
Share
Recommend
Pandu Ranga G
8 months ago
Hi ,
Drop-Down Box:
i Couldn`t able to select an item using selectbyvalue nor selectbyvisibletext - please help me on this.
2
Reply Share
8 months ago
Hi Pandu,
open in browser PRO version
pdfcrowd.com
As already stated by them its not available for all the web pages... selectByVisibleText & selectByindex w
helpful for all the webpages.
vivek
Reply Share
4 months ago
Reply Share
3 months ago
Subscribe
Reply Share
Privacy
pdfcrowd.com
About
Contact Us
About us
Corporate
Training
Jobs
Contact us
FAQ
Write For Us
Android
App
Certifications Execute
online
ISTQB
Certification
MySQL
Certification
QTP
Certification
Testing
Certification
Execute Java
Online
Execute PHP
Online
Execute
PERL Online
Execute
Javascript
Execute
HTML
Execute
Python
Interesting!
Books to
Read!
Contest
Quiz
pdfcrowd.com