1

リンクイン ( http://www.linkedin.com/people/pymk?trk=nmp-pymk-new_pymk_title )の「知り合いかもしれない人」ページの接続ボタンをクリックしようとしています。

このボタンの HTML コードは次のとおりです。

<a class="vcard-button bt-connect bt-primary" href="#"><span>&nbsp;</span>Connect</a>

私はこれをやろうとしました:

buttons=driver.find_elements_by_css_selector("a[class='vcard-button bt-connect bt-primary']") 

次に、リストの各要素に対して関数 click() を呼び出します。ただし、同じエラーが発生し続けます:

selenium.common.exceptions.WebDriverException: Message: u'unknown error: Element is not clickable at point (473, 14). Other element would receive the click: <input name="keywords" id="main-search-box" class="search-term" type="text" value="" autocomplete="off" placeholder="Search for people, jobs, companies, and more...">
(Session info: chrome=30.0.1599.101)
(Driver info: chromedriver=2.2,platform=Windows NT 6.1 SP1 x86_64)'

誰かが私が間違っていることを知っていますか?

4

1 に答える 1

2
from selenium.webdriver.common.action_chains import ActionChains
self.driver = webdriver.Firefox()
# You need a mouse to hover the span elements here
self.mouse = webdriver.ActionChains(self.driver)    

# You need get the element from its xpath:
buttons=driver.find_elements_by_css_selector("a[class='vcard-button bt-connect bt-primary']")

# Then you hover on span element by mouse and click on it:
self.mouse.move_to_element(buttons).click().perform()
于 2013-11-18T07:27:09.330 に答える