How to select value form drop down list in selenium (Web-driver java):

I want to select the value from the drop down (drop down values changes when i change the values of previous drop down on the same page.) i have tried but nothing happened.

Java Code:

driver.findElement(By.xpath("//* @id='ctl00_CPHPageContents_rcbBranch_Input']")).sendKeys(Keys.DOWN);
//search.sendKeys(Keys.TAB);

HTML:

<tr>
    <td class="rcbInputCell rcbInputCellLeft" style="width:100%;">
    <input id="ctl00_CPHPageContents_ddlAssignedTo_Input" class="rcbInput radPreventDecorate" type="text" value="ghaffar, a" name="ctl00$CPHPageContents$ddlAssignedTo" autocomplete="off"/>
    </td>

Answers


Selenium has special class designed to interact with drop down lists called Select. From there you can easily choose option by id, index or displayed value.


Try with this

WebElement dropDownListBox = driver.findElement(By.id("country"));

Select clickThis = new Select(dropDownListBox);

clickThis.selectByVisibleText("(+44) United Kingdom");

Hope it helps


1st you deselected all the values in the multi select box then select the values which you want.. It is working properly..

Log.info("Clicking on Softwarepack dropdown");
JavascriptExecutor execu = (JavascriptExecutor)driver;
execu.executeScript("document.getElementById('TestID').style.display='block';");
Select sel = new Select(driver.findElement(By.id("TestID")));
sel.deselectAll();
sel.selectByVisibleText("Value");
Thread.sleep(6000);

Try it this

public void(string[item])) {

    WebElement dropDown = driver.findElement(By.id("countTd"));
    dropDown.click();

    driver.findElement(By.xpath("//td[@id='countTd']/span[text()='" + item + "']")).click();
}

Need Your Help

Python redmine: wiki page text

python python-3.x redmine

I use python-redmine and want to get wiki page text, but get error - attribute isn't exists (but text exists), here is my code:

Should a database table that contains two columns that are foreign keys have a third column which is the primary key?

database database-design primary-key

I am guessing no, since the foreign keys are the primary keys in their own tables, so they will be unique.