Selenium+firefox: empty execute_script arguments

前端 未结 2 441
星月不相逢
星月不相逢 2021-01-06 04:49

I\'m trying to set textarea value using javascript instead send_keys() method.

As documentation says, I should be able to pass webelement to execute_scr

2条回答
  •  北海茫月
    2021-01-06 05:27

    Here is the relevant bug: Firefox 35: Passing arguments to executeScript isn't working.

    Which was fixed in selenium 2.45 which was released today, upgrade selenium package:

    pip install --upgrade selenium
    

    Old answer:

    I was able to reproduce the problem using selenium==2.44.0 and Firefox 35.0:

    >>> element = web.find_element_by_tag_name('textarea')
    >>> web.execute_script("return arguments",element)
    []
    

    Downgrading to Firefox 34.0.5 solved the issue:

    >>> element = web.find_element_by_tag_name('textarea')
    []
    

提交回复
热议问题