Send keys not working in selenium with python

给你一囗甜甜゛ 提交于 2019-12-11 07:27:21

问题


send keys are not working in selenium with python. This was working earlier but it fails now. I don't know what may be the issue . It gives following error :

u"Element is disabled and so may not be used
for actions\nCommand duration or timeout: 11             
milliseconds\nBuild info: version: '2.15.0', revision: '15105', time:
'2011-12-08   09:56:25'\nSystem info: os.name: 'Windows 7', os.arch:
'amd64', os.version: '6.1',    java.version: '1.6.0_22'

I have used below along with time.sleep(3) before passing keys

elem.send_keys('selenium')   
elem.send_keys(Keys.RETURN)    

Also

elem.send_keys("Sale" + Keys.RETURN)   

But nothing works


回答1:


As the error says, the element is disabled and hence you(a user using a browser, selenium tries to mimic such a user) can not interact with that element.




回答2:


I noticed this also. find_element_by_* returns a list. A quick fix is to use the first element, i.e. elem[0].send_keys(text).



来源:https://stackoverflow.com/questions/10007339/send-keys-not-working-in-selenium-with-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!