phantomjs icon indicating copy to clipboard operation
phantomjs copied to clipboard

Element is not currently visible and may not be manipulated exception

Open skov555 opened this issue 13 years ago • 80 comments

Simple code in selenium works in both Firefox driver and HtmlUnit driver but it fails with PhantomJs as it returns element not visible exception.

Steps.

  1. Go to page https://signup.live.com/
  2. Select element by id iBirthDay
  3. Set value by value

skov555 avatar Sep 23 '13 04:09 skov555

I get the same problem. I have a form with just two input fields. Works perfectly OK in Firefox and other browsers, but when using PhantomJS, I get an

"InvalidElementStateException: Message: u'Error Message => 'Element is not currently interactable and may not be manipulated"

I can clearly see the the input elements are present when I take a screenshot via selenium functions.

Is this an issue with PhantomJS itself?

fraogongi avatar Oct 08 '13 06:10 fraogongi

Have the same problem. Using Coypu. When running in Firefox everything works fine, but in PhantomJS I get a ElementNotVisibleException when I try to sumulate a link click.

From screenshots I can see that the link is visible.

simon-k avatar Oct 21 '13 09:10 simon-k

Same problem with pahntomjs version 1.9.2. To reproduce - navigate to the same page twice, then try to click visible element webdriver.get(url) webdriver.get(url) webdriver.find('#my_elem').click()

raises ElementNotVisibleException: 'Element is not currently visible and may not be manipulated'

Fak3 avatar Oct 23 '13 10:10 Fak3

I'm also encountering this issue (works fine in Firefox, chokes in PhantomJS) using WebDriver with Python

Here's the snippet in question:

driver.execute_script("window.scrollTo("+ str(selected_sites_textbox_location['x']) + ","+ str(selected_sites_textbox_location['y']) +");")

for site_name in site_names:
     for num_placements in range(scraper.conf['sites'][site_name]):
           # Code chokes here.
           selected_sites_textbox.send_keys(site_name)
           sleep(2)
           selected_sites_textbox.send_keys(Keys.RETURN)

TheNorthEestern avatar Oct 28 '13 21:10 TheNorthEestern

Same for me, works on Firefox but not working with PhantomJS. "phantomjs ElementNotVisibleException: Message: u'Error Message => 'Element is not currently visible and may not be manipulated"

shankisg avatar Nov 08 '13 14:11 shankisg

Hi guys, I just found a solution. Try this browser = webdriver.PhantomJS() browser.set_window_size(1124, 850) # set browser size. browser.get("http:example.com") # Load page

The solution is we need to set a fake browser size before doing browser.get("").

Hope this helps

shankisg avatar Nov 08 '13 16:11 shankisg

I was setting window, so it will not solve my issue. I am taking screenshot and I can see element there but it still will give this error when I try to change value of that element.

skov555 avatar Nov 08 '13 17:11 skov555

I set the window to maximize and the problem persisted. Looking at the screenshot though it was only 400px wide. The element was visible, but on a hunch I set the screen dimensions to exactly 1024px wide and the test passed.

Synesso avatar Nov 11 '13 04:11 Synesso

I also have this problem and i have an idea why it's happening. It seems like when there is a div, (which is always visible and does not scroll) (Like on the live.com website), The displayed property for this div is true, but for all other elements on that page, it is false.

simplexx avatar Dec 08 '13 22:12 simplexx

I also have this problem, resizing the window does fix it.

Thanks to @shankig

nchagrass avatar Dec 11 '13 10:12 nchagrass

Resizing or changing window size is not fixing it. In your case it is not a issue but you just did not set window size correctly. Issue is when you have window set up and on screen shot you can see element but browser reports it as invisible.

skov555 avatar Dec 11 '13 13:12 skov555

Resizing the window seems to have remedied the issue for me, but this isn't really a fix, considering the original script ran fine without a hitch in Firefox without having to resize the window.

TheNorthEestern avatar Dec 11 '13 15:12 TheNorthEestern

Like i said, this problem occurs on certain websites when there is a div, which is fixed and always visible. check https://signup.live.com/

simplexx avatar Dec 11 '13 16:12 simplexx

Hi guys, I have tried a lot with different ways to solve the issue. But resizing the window was the last option available to me.

shankisg avatar Dec 13 '13 10:12 shankisg

I am experiencing this issue with clearly visible radio buttons. Tests run fine in Firefox but fail in phantonjs, the page resize work around does not resolve the issue for me.

mokies avatar Jan 07 '14 21:01 mokies

Was just running into this issue myself process was clearing text input value then entering new value changed driver.clear() to driver.clear w/o parens and works fine

micurley avatar Jan 23 '14 05:01 micurley

using protractor.js, setting window size fixed this error. thanks @shankig

driver.manage().window().setSize(1000, 800);

jdewit avatar Feb 07 '14 19:02 jdewit

Calling: element.clear before using element.set_keys works for me! Thanks micurley.

macdonjo avatar Feb 17 '14 18:02 macdonjo

Thanks @shankig browser.set_window_size(1440, 900) # Fixes "Element is not currently interactable and may not be manipulated" in PhantomJS 1.9.7

Saren-Arterius avatar Feb 20 '14 10:02 Saren-Arterius

Thanks @shankig browser.set_window_size(1120, 550) works

nishannakarmi avatar Jul 28 '14 09:07 nishannakarmi