-1

I already tried *select from list* methods but to no avail (It always cannot find the element). Please see the screenshot here and help me in handling it. I want to select DELHI option from the Payment Location dropdown options

Similarly how to handle this dropdown here (Cost Center). The suggestion only comes when we type letters in it. I tried it with 'select from list by index 0' but that did not help.

Sammy
  • 25
  • 2
  • 11
  • You need to show us the HTML that you are trying to match, and the locator that you are using. We can't invent a way to get at a web element only by looking at a screenshot. – Bryan Oakley Jun 03 '17 at 12:48
  • The screenshot contains the DOM structure as well. I tried with #select from list name=Delhi and also "select from list by index 0" but that does not find the element @BryanOakley – Sammy Jun 03 '17 at 12:56

1 Answers1

0

Not having access to the actual code limits us in helping you. Screenshots, especially those not included but linked to, are a burden to work with. Use the enter image description here image functionality to add an inline image. However, copy and paste the actual code is always preferred.

When the specialized functions like select from list are not working you can always revert back to the basic steps of click element and xpath.

In this case I'm asuming that the options are already available in the DOM before clicking on the menu. If that is the case I think click element xpath=//select[@id='id_location']/option[text() = 'Delhi'] should work for you. Otherwise, add a preceding click element xpath=//select[@id='id_location'] to first click the menu, so that the items are loaded.

For the second menu you mention that this menu is only populated when text is typed into the box. Here I'd follow the same approach as above. Use input text xpath=//.... generating the menu items you seek and the proceed by click element xpath=//... for the actual menu selection.

A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
  • Yes, the first one worked. Can you help me out with the 2nd one here is what I am writing `click element xpath=//form[@id='id_create-shipment-step-1']//div[5]//a/span` to click on REASON1 which appears on dropdown but unable to get the desired result. See screenshot [https://www.dropbox.com/s/te7fmt6gtwxk46b/Screenshot%202017-06-03%2023.09.31.png?dl=0] In the report generated it says `FAIL ValueError: Element locator 'xpath=//form[@id='id_create-shipment-step-1']//div[5]//a/span' did not match any elements. ` – Sammy Jun 03 '17 at 17:40
  • Is this a list that has all the options filled in when the page is loaded, or is it dynamically filled when clicked upon? It seems to me that this is a dynamic field, like the _Cost Center_ one. If that is the case, then first click on the field. `click element xpath=//form[@id='id_create-shipment-step-1']//div[5]`, (Optionally) `Input text xpath=//form[@id='id_create-shipment-step-1']//div[5] reason 1` and then proceed to pick the desired option by `Click Element xpath=//form[@id='id_create-shipment-step-1']//div[5]//a`. – A. Kootstra Jun 03 '17 at 21:21