Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Cannot locate the class Select in web driver

View previous topic View next topic Go down

Cannot locate the class Select in web driver

Post by abcedf on Thu Mar 17, 2011 3:28 pm

I use firefox and the firefox plugin .

I try to use select class like below

Select select1 = new Select(driver.findElement(By.name("Language")));
select1.deselectAll();
select1.selectByVisibleText("english");

I get below error when complie

symbol : class Select
location: class org.openqa.selenium.example.HGC1
Select select1 = new
Select(driver.findElement(By.name("Language")));
The select class in missing in the selenium-java-2.ob2.jar ??
How can I find this class ???
Please advice ....

abcedf

Posts : 2
Join date : 2011-03-17

Back to top Go down

Re: Cannot locate the class Select in web driver

Post by Adviser on Thu Mar 17, 2011 8:02 pm

Hi ,

you can't select the list via select command directly in webdriver. You need to follow the way present in following code :

Code:

/**
 * Select single/multiple options.
 * Assume that you have Internet Explorer and Selenium Server is running on your
 *  computer on default port 4444. Otherwise, change accordingly in the constructor.
 * @Author: Xuan Ngo
 */
import com.thoughtworks.selenium.DefaultSelenium;
 
public class Select
{
  private DefaultSelenium m_oBrowser = null;
 
  public static void main(String[] args)
  {
    Select oSelect = new Select();
 
    // Select single/multiple options.
    oSelect.runExamples();
  }
 
  // Constructor
  public Select()
  {
    this.m_oBrowser = new DefaultSelenium("localhost", 4444, "*iexplore", "http://openwritings.net/");
    this.m_oBrowser.start(); // Start Selenium.
    this.m_oBrowser.open("http://openwritings.net/sites/default/files/select.html"); // Open the webpage.
  }
 
  // Select single/multiple options.
  public void runExamples()
  {
    // Single Selection: Use ID locator and LABEL option locator to select July.
    this.m_oBrowser.select("id=single-selection", "label=July");
 
    // Multiple Selections: Use variations of locators to select February, August and November.
    this.m_oBrowser.select("xpath=//select[@size='12']", "value=Feb");                            // Select February
    this.m_oBrowser.addSelection("css=select[id=multi-selections]", "index=7");                    // and August.
    this.m_oBrowser.addSelection("dom=document.getElementById('multi-selections')", "id=m_opt_10");// and November.
 
    http://this.m_oBrowser.stop(); // Close Selenium.
  }
}

Hope this will help you. best of luck.

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum