Welcome to Selenium Webdriver Forum

As a web user you can read and search through forum content. Once you have registered and signed you can post topics, post replies, set up watch lists, modify forum settings, and use private messaging.

Author Topic: Select item from drop-down list  (Read 2354 times)

Mars Yu

  • Web User
Select item from drop-down list
« on: April 10, 2012, 11:07:44 PM »
I'm new to web driver, when I try to wrap the drop down list, I met
 the problem with select the item from the list.
 The phenomenon is I can select the item by given value, but after
 that, it back to default value in that list. My code below.
        public void selectItem(final String itemName) {
                 WebElement elements = driver.findElement(By.xpath(this.locator));
                 Select select = new Select(elements);
The page source,
<select id="1009" class="gwt-ListBox formComboBox formFocusControl
 formControl" tabindex="7" style="width: 67px; height: 21px; font-size:
 8pt; font-family: MS Sans Serif; position: absolute; left: 278px; top:
 <option value="0">0</option>
 <option value="1">1</option>
 <option value="2">2</option>
 <option value="3">3</option>

Natraj Yerram

  • Web User
Re: Select item from drop-down list
« Reply #1 on: April 10, 2012, 11:08:04 PM »
Hi Experts,
While i am trying to execute below junit code i am receiving below error .
11:24:22.171 INFO – Got result: XHR ERROR: URL =
 https://jazz-qa.fundquest.com/jazz/userSecurity/login.htm Response_Code = -1
 Error_Message = Request Error on session b5727bdb78fb4df4b7c98465cd102557
Could you please let me know what could be the problem?
 ——package com.example.tests;
import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 //import org.openqa.selenium.server.RemoteControlConfiguration;
 import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.*;
public class ABCCls {
 private static SeleniumServer seleniumServer;
 private static Selenium selenium = new DefaultSelenium( “localhost”,4444,
 public static void setUpBeforeClass() throws Exception {


 public static void tearDownAfterClass() throws Exception {

 public void testUntitled() throws Exception {
 selenium.type(“username”, “redi2admin”);
 selenium.type(“password”, “redi2blue”);
 selenium.type(“number”, “C54190258″);

 public void setUp() throws Exception {
 seleniumServer = new SeleniumServer();

 public void tearDown() throws Exception {

 1:24:12.953 INFO – Preparing Firefox profile…
 11:24:16.546 INFO – Launching Firefox…
 11:24:21.718 INFO – Got result: OK,b5727bdb78fb4df4b7c98465cd102557 on
 session b5727bdb78fb4df4b7c98465cd102557
 11:24:21.734 INFO – Command request: open[/jazz/userSecurity/login.htm, ] on
 session b5727bdb78fb4df4b7c98465cd102557
 11:24:22.171 INFO – Got result: XHR ERROR: URL =
 https://jazz-qa.fundquest.com/jazz/userSecurity/login.htm Response_Code = -1
 Error_Message = Request Error on session b5727bdb78fb4df4b7c98465cd102557
- Show quoted text -


Related Topics

  Subject / Started by Replies Last post
1 Replies
Last post February 22, 2012, 06:05:41 PM
by Mike Schaufelberger
2 Replies
Last post March 27, 2012, 09:14:13 PM
by Simon Stewart
2 Replies
Last post April 02, 2012, 10:25:53 PM
by Mark Collin
1 Replies
Last post April 10, 2012, 10:57:30 PM
by Scal
7 Replies
Last post April 15, 2012, 05:39:11 PM
by Hien Ngo
1 Replies
Last post July 24, 2012, 08:22:10 PM
by testingzeal
0 Replies
Last post August 19, 2013, 03:37:53 PM
by therealjake