简体   繁体   中英

entering a value in a text box using python selenium

I started to learn python selenium but I have a simple problem that I can't Understand it ... It can open site but can't write anything in any boxes ... It just open the site ...

what's the problem ???

Search field name is"q"

<input id="id-search-field" name="q" type="search" role="textbox" class="search-field placeholder" placeholder="Search" value="" tabindex="1">

and the code is :

from selenium.webdriver import Chrome
from selenium.webdriver.common.keys import Keys


driver = Chrome("C://chromedriver.exe")
driver.get("http://www.python.org")


elem = driver.find_element_by_name("q")
elem.send_keys("selenium")
elem.send_keys(Keys.RETURN)

driver.close()

I just found it ... it was because of my webdriver version ...

sorry I don't know how to delete my topic ...

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