0

Is it possible to make selenium IDE open a dropdown menu to show all options? I have a test case where I need to open a dropdown and take a screenshot as evidence of all options there ... but can't figure out a way to do this. P.s: the click option does not do anything, already tried it.

Jobins John
  • 1,265
  • 23
  • 45
sanjuro8998
  • 1,161
  • 2
  • 14
  • 22

2 Answers2

1

Check this out:

storeXpathCount | //select[@id='LANGUAGE']/option | count
storeEval       | window.document.getElementById('LANGUAGE').setAttribute('size', ${count}) | lol

But I don't know why do you need a screenshot to prove something while you can just check it by standart selenium IDE command:

assertText | id=LANGUAGE | - Select from list - (en_US) Canada Canadian French United States English
Antesser
  • 669
  • 4
  • 5
  • It modifies the dropdown appearance ... the test is to validate the UI ... I must prove in a screenshot that the dropdown works and show the options, is not actually to validade the options there :-) – sanjuro8998 Mar 31 '16 at 14:19
  • In that case I suppose nobody can help you. – Antesser Mar 31 '16 at 15:08
  • Selenium IDE is using javascript to perform actions on the page. But that is impossible to open dropdown with javascript. Take a look here http://stackoverflow.com/questions/430237/is-it-possible-to-use-js-to-open-an-html-select-to-show-its-option-list. That's why that is impossible to do with selenium IDE too. – Antesser Mar 31 '16 at 15:12
0

Check this code:

Actions action = new Actions(driver);
    action.clickAndHold(driver.findElement(By.id("dropdownid"))).build().perform();
    //you need to release the control from the test
    //actions.MoveToElement(driver.findElement(By.id("dropdownid"))).Release();