我用这段代码来浏览tripadvisor(葡萄牙语评论)
from selenium import webdriver
from bs4 import BeautifulSoup
driver=webdriver.Firefox()
driver.get("https://www.tripadvisor.com/Airline_Review-d8729164-Reviews-Cheap-Flights-TAP-Portugal#review_425811350")
driver.set_window_size(1920, 1080)
然后我试着点击谷歌翻译链接
^{pr2}$但得到这个错误:
WebDriverException: Message: Element is not clickable at point (854.5, 10.100006103515625). Other element would receive the click: <div class="inner easyClear"></div>
所以div class="inner easyClear"
得到了点击。我试着去探索
from bs4 import BeautifulSoup
page=driver.page_source
for i in page.findAll("div","easyClear"):
print i
print "================="
但无法从中获得任何直觉,比如现在要加入什么样的改变,使“谷歌翻译”可以点击。请帮忙
===============================编辑======================================
我也试过这些
driver.execute_script("window.scrollTo(0, 1200);")
driver.find_element_by_class_name("googleTranslation").click()
将浏览器调整到全屏等。。在
对我有效的方法是使用显式Wait和
element_to_be_clickable
预期条件,然后到达内部的span
元素:你也可能会进入一个“调查”或“晋升”弹出窗口-请务必说明这些。在
相关问题 更多 >
编程相关推荐