【问题标题】:Python script hang when uploading a file with selenium phantomjs使用 selenium phantomjs 上传文件时 Python 脚本挂起
【发布时间】:2017-11-30 16:37:52
【问题描述】:

我需要使用 selenium 和 phantomjs 上传图像,但是只有当我单击“上传文件”按钮时才会生成输入字段,该按钮会在 firefox 上弹出“上传文件”窗口。

我有这段代码点击“上传文件”按钮生成html输入字段,然后将图像的路径发送给它。

browser.find_element_by_xpath("xpath_to_button").click()
browser.find_element_by_xpath("xpath_to_input_field").send_keys(img_path)

使用 firefox webdriver 工作正常,但使用 phantomjs webdriver 调用 send_keys() 时脚本挂起

【问题讨论】:

    标签: python selenium phantomjs


    【解决方案1】:

    我发现这个错误来自 PhantomJS 驱动程序本身,我刚刚切换到无头 chrome 驱动程序,现在它工作正常。

    【讨论】:

      猜你喜欢
      • 2019-05-17
      • 1970-01-01
      • 2013-04-25
      • 1970-01-01
      • 2017-07-17
      • 1970-01-01
      • 2021-02-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多