- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用一个简单的 webdriver phantomjs 脚本来更新 preloved.co.uk 上的一些广告。该脚本直到最近都运行良好,但在单击登录链接后开始失败,出现“单击已提交但加载失败”错误。按照this我按照指南 here 将 phantomjs 版本更新到最新稳定版 1.9.7 。但是,现在登录点击似乎也没有注册,并且页面没有重新加载。
第一步只是进入登录表单页面。
from selenium import webdriver
br = webdriver.PhantomJS(service_log_path='/path/to/logfile.log')
url = "http://www.preloved.co.uk"
br.get(url)
# Go to login page
login_button = br.find_element_by_xpath('//div[@id="header-status-login"]/a')
login_button.click()
通常(例如,如果您将浏览器行替换为 br = webdriver.Firefox()
),这会导致重新加载到登录页面,并且脚本从那里继续,但现在它出现了单击根本不会加载新页面,并且 br.current_url
仍然是 ' http://www.preloved.co.uk/ '
为什么这个负载不起作用?
即使我提取 href 并执行显式 GET,它似乎也不会遵循并重新加载:
newurl=login_button.get_attribute('href')
br.get(newurl)
br.current_url
仍然是 ' http://www.preloved.co.uk/ '.
最佳答案
登录页面通过 https 进行保护。最近,POODLE 漏洞迫使网站从 SSLv3 转向 https,但由于 PhantomJS 使用 SSLv3 per default登录页面无法加载。另请参阅this answer .
可以通过将 --ssl-protocol=tlsv1
或 --ssl-protocol=any
传递给 PhantomJS 或将 PhantomJS 升级到至少版本 1.9.8 来修复此问题。看来 service_args
参数可以用于 Selenium 的 python 绑定(bind)中。
看起来像 current official implementation service_args
无法从 WebDriver
传递到 PhantomJS 中的 Service
。您可以对其进行子类化。
from selenium import webdriver
from selenium.webdriver.phantomjs.service import Service
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
class PhantomJSService(webdriver.PhantomJS):
def __init__(self, executable_path="phantomjs", port=0,
desired_capabilities=DesiredCapabilities.PHANTOMJS,
service_args=None, service_log_path=None):
self.service = Service(executable_path,
port=port, service_args=service_args,
log_path=service_log_path)
self.service.start()
try:
RemoteWebDriver.__init__(self,
command_executor=self.service.service_url,
desired_capabilities=desired_capabilities)
except:
self.quit()
raise
看来这个webdriver fork包含设置这些选项所需的参数。
关于python - Webdriver phantomjs 不再跟随点击链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26560833/
我试图在我的数据库中找到所有关注该用户的用户。 followers 集合有 3 个字段:_id、_t、_f。 当一个用户关注另一个用户时,它会将他们的用户 ID 添加到 _f 并将目标用户的 ID 添
我有一个 UICollectionView,它由单元格中的 UIImagePickerControl 按钮填充,我希望跟随 Collection View 末尾的单元格通过屏幕,但仍允许用户滚动 -
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 9 个月前。 Improv
好的,所以我知道如何将文本剪裁成特定的几何形状,但是文本不会根据剪裁自动换行,那么如果您有“勾选”作为几何/路径? 是否需要手动添加适合每一行的文本框,然后根据适合/不适合的内容拆分文本? 最佳答案
我里面有链接 s,但我在所有 上也有一个点击事件s。代码如下所示: $( document ).ready( function() { $( 'td.event' ).click( func
短版: 是)我有的: 2 元组列表,例如 [("a", "b"), ("b", "c"), ("d", "e"), ("c", "d"), ("f", "g")]不一定按字母顺序排列 我想要的是: 给
我正在尝试使用 xpath 来获取表的内容。 表格看起来像这样 Stuff Contents Contents Stuff
我有几个像这样的div: My Link 问题是,如果用户单击 div 而不是文本,则链接不会触发。这是我到目前为止所拥有的: $('#TopMenuBar .MenuList').click
我想要做一个链接到这个 .after() 的 .fadeIn() 动画,但这似乎不是这样做的方法。有什么建议吗? $(clicked_item).parent().parent().parent().
int getIdForSong(Song song){ String selectQuery = "SELECT id FROM " + TABLE_SONG + " WHERE " + S
现在右侧的 div 一直跟随滚动。如果我想让它在页面滚动到div的顶部时开始跟随滚动,并在向上滚动时让它保持在那里,我还需要做什么? jsfiddle $(window).scroll(functio
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and t
我正在为我的客户设计一件 T 恤,我使用 html5 Canvas 制作了它。衬衫设计师现在已经完成,但他要求我添加一个放大镜(类似这样的东西:http://mlens.musings.it/)。我在
我正在尝试调试远程主机上的 fork 进程,但每次都让 gdbserver 进程在子退出时结束。 尝试在 .gdbinit 中设置“set follow-fork-mode child”,没有帮助。
我正在制作一个带有滚动控件的响应式菜单。我有一个小问题,我的渐变和控件跟随,滚动时,你可以在我的 JSFiddle 中看到它. 我的菜单控件有我的 CSS #page .page-nav .contr
我将我的页面分为左右两部分。我用 div 来制作左导航和右导航。在右侧导航中,我也有多个 div。现在,当我向下滚动页面时,只有页面的右侧部分正在滚动,而左侧导航则停留在那里。 所以当我向下滚动页面时
我刚刚开始使用 svg 和 anime.js。我正在尝试重新创建 svg motion path在文档中找到我自己的 Assets 。不过,我没有使用 div 来跟随路径,而是使用了另一条路径。 我有
我将展示整个代码,但请注意指针上方的引号,因为我将在那里讨论我的问题。我会在引用评论中告诉你我认为那里发生了什么。代码编译并运行,我只需要帮助理解部分代码。 #include #include i
我在左侧有一个 div,其中包括营业时间和天气。我希望该 div 根据用户的滚动方式向下和向上滚动。所以它会跟随页面上下移动。我将如何尝试呢?这是我的网站judystropicalgarden.com
所以我遇到了这个小问题,我的相机错误地固定在播放器上。 左上角的蓝色 Sprite 是玩家,但它应该位于屏幕中央。关于这个问题的所有其他线程都使用固定渲染管道,而我使用基于 VBO 的线程。 我的矩阵
我是一名优秀的程序员,十分优秀!