2

I'm having the following problem. I have a dropdown that is hidden so when I make the Select and run the test i get the following error:

selenium.common.exceptions.ElementNotVisibleException: Message: element not visible: Element is not currently visible and may not be manipulated

below is the code i have been trying:

cur=Select(driver.find_element_by_id("currencyCode"))
cur.select_by_visible_text('USD')

below is the html syntax of the code:

<div class="form-group true-grid-3">
            <label for="currencyCode">Currency</label>
            <select id="currencyCode" name="criteria.currencyCode" class="form-control" style="display: none;">
                <option value="CHF">CHF</option>
                <option value="EUR">EUR</option>
                <option value="GBP">GBP</option>
                <option value="JPY">JPY</option>
                <option value="USD">USD</option>

2 Answers 2

3

Set the display: none to display: block in the css property so that the element becomes visible.

driver.execute_script("document.getElementById('criteria.currencyCode').style.display = 'block';")
Sign up to request clarification or add additional context in comments.

1 Comment

This solution works perfect if i change the id from "criteria.currencyCode" to "currencyCode" Thanks a ton!
1

You can try to call drop-down driver.find_element_by_id("currencyCode").click() and then, when options became visible, choose required option driver.find_element_by_xpath('//option[@value="USD"]').click()

1 Comment

kept showing the same error andersson, it worked if i changed the display from "none" to "block" using javascript code. Thanks !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.