嗨我试图使用此代码,代码中的登录部分工作正常,但代码中的帖子部分不工作:( 我尝试使用python 2.7和3.4.0和3.4.1以及firefox浏览器最后的版本,它不起作用
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
usr = raw_input('--> ')
pwd = raw_input('--> ')
poo = raw_input('--> ')
url = 'https://www.facebook.com/groups/<group id you are a member in>'
driver = webdriver.Firefox()
# or you can use Chrome(executable_path="/usr/bin/chromedriver")
driver.get(url)
assert "Facebook" in driver.title
elem = driver.find_element_by_id("email")
elem.send_keys(usr)
elem = driver.find_element_by_id("pass")
elem.send_keys(pwd)
elem.send_keys(Keys.RETURN)
driver.implicitly_wait(20)
elem = driver.find_element_by_css_selector(".input.textInput")
elem.send_keys(poo)
driver.implicitly_wait(20)
elem = driver.find_element_by_css_selector(".selected")
elem.send_keys(Keys.RETURN)
elem.click()
答案 0 :(得分:-1)
在Selenium IDE中,如果你知道它的价值或标题,你可以调用一个按钮:
Command | click
Target | //input[@value='PUT_A_VALUE_HERE' and @title='PUT_A_TITLE_HERE']