简体   繁体   中英

python-selenium returning element is not interactable error

I am using selenium-python binding. I am getting the following error while trying to select and manipulate an element. (using Chromedriver)

Message: invalid element state: Element is not currently interactable and may not be manipulated

I think the element is successfully selected with the following syntax: but I cannot manipulate it with, for example, clear() or send_keys("some value"). I would like to fill the text area, but I cannot make it work. If you have experienced similar problems, please share your thought. Thank you.

UPDATE: I noticed html is changing as I manually type to style="display: none" that might be a reason for this error. Modified the code below. Can you please point out any solution?

driver.find_element(by='xpath', value="//table[@class='input table']//input[@id='gwt-debug-url-suggest-box']")

or

driver.find_element(by='xpath', value="//input[@id='gwt-debug-url-suggest-box']")

or

driver.find_element_by_id("gwt-uid-47")

or

driver.find_element(by='xpath', value="//div[contains(@class, 'sppb-b')][normalize-space()='www.example.com/page']")

Here is the html source code:

<div>
    <div class="spH-c" id="gwt-uid-64"> Your landing page </div>
    <div class="spH-f">
        <table class="input-table" width="100%">
            <tbody>
                <tr>
                    <td class="spA-e">
                        <div class="sppb-a" id="gwt-uid-47">
                            <div class="sppb-b spA-b" aria-hidden="true" style="display: none;">www.example.com/page</div>
                            <input type="text" class="spC-a sppb-c" id="gwt-debug-url-suggest-box" aria-labelledby="gwt-uid-64 gwt-uid-47" dir="">
                            </div>
                            <div class="error" style="display:none" id="gwt-debug-invalid-url-error-message" role="alert"> Please enter a valid URL. </div>
                        </td>
                        <td class="spB-b">
                            <div class="spB-a" aria-hidden="true" style="display: none;"></div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

Have you tried selecting by:

driver.find_element_by_id("gwt-debug-url-suggest-box")
driver.send_keys("Your input")

This way you are selecting the input directly. Anyway,the link to the page would help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM