Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8379347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:09:30+00:00 2026-06-09T16:09:30+00:00

With Selenium WebDriver I’m attempting to select drop down menu elements on a webpage

  • 0

With Selenium WebDriver I’m attempting to select drop down menu elements on a webpage by strings read from an Excel file:

        Xls_Reader data = new Xls_Reader("src//com//testexcel//data//data3.xlsx");
        String values = data.getCellData("DropList", "Index_Value", 2);
        String selections[] = values.split(",");

They are in this form: Construction,Engineering,Legal,etc.

Each element I am trying to select looks like this:

<div class="ui-dropdownchecklist-item ui-state-default" style="white-space: nowrap;">
<input id="ddcl-selInd-i3" class="active" type="checkbox" tabindex="0" index="3" value="11">
<label class="ui-dropdownchecklist-text" for="ddcl-selInd-i3" style="cursor: default;">Construction</label>
</div>

<div class="ui-dropdownchecklist-item ui-state-default" style="white-space: nowrap;">
<input id="ddcl-selInd-i5" class="active" type="checkbox" tabindex="0" index="5" value="03">
<label class="ui-dropdownchecklist-text" for="ddcl-selInd-i5" style="cursor: default;">Engineering</label>
</div>

Here is the code:

package com.selftechy.parameterization;

import java.util.ArrayList;
import java.util.List;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class JobServe {

    static WebDriver driver = new FirefoxDriver();

    public static void main(String[] args) throws InterruptedException {


        driver.get("https://www.jobserve.com/gb/en/Candidate/Home.aspx");
        driver.findElement(By.xpath(".//*[@id='ddcl-selInd']/span")).click();

        readExcelWords();


    public static void readExcelWords() {
        Xls_Reader data = new Xls_Reader("src//com//testexcel//data//data3.xlsx");
        String values = data.getCellData("DropList", "Index_Value", 2);
        String selections[] = values.split(",");

//help  
List<WebElement> iList = driver.findElements(By.xpath("//*[@id='ddcl-selInd-ddw']"));
    for (int i=0; i<selections.length; i++) {
    driver.findElement(By.xpath("//*[text()='" + selections[i] + "']")).click();

I know the xpath is wrong and possibly the way I am working with data types. I need a way of making xpath selection work on the basis of the array values. I am relatively new to Java and Selenium and would appreciate some help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:09:32+00:00Added an answer on June 9, 2026 at 4:09 pm

    Try

    findElement(By.xpath("//label[.='xyz']/../input"));
    

    where xyz is one of Construction, Engineering, etc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying a select a text from the Dropdown Menu using Selenium webdriver
Can anyone help me to read a label text from selenium webdriver The for
I am using Selenium WebDriver and want to execute some javascript from a webpage.
I'm using Selenium WebDriver with Testng (started using an .xml file) to test a
I have the following code in python from selenium import webdriver from selenium.webdriver.common.by import
I am using Selenium webdriver in Python for a web-scraping project. The webpage, I
I'm attempting to use the selenium-webdriver [ruby bindings][1] to access an internal web-site that
I've just updated my selenium WebDriver from a pretty old version which allowed me
I've read here and there that we should now use Selenium 2 (WebDriver if
I am using Selenium WebDriver and run into an issue. In the UI, elements

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.