小编kry*_*rro的帖子

DeprecationWarning:在Python中使用Geckodriver和Selenium将setter用于无头属性,而不是set_headless opts.set_headless(headless = True)

我有一个非常基本的Python脚本,该脚本可以在本地计算机(Mint 19)上完美运行,但是在远程机器上(Ubuntu 16.04)却无法运行。相同的文件,两个Python 3.7。我在/ usr / local / bin中有geckodriver,它从命令行使用gecko --version从路径中检出。我不知道是什么问题。geckodriver.log文件只是说:

1541268536111   mozrunner::runner   INFO    Running command: "/usr/bin/firefox" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.Mt6zAyZc7D01"
*** You are running in headless mode.
1541268546125   Marionette  INFO    Listening on port 33632
Run Code Online (Sandbox Code Playgroud)

来自终端的错误是:

root@dev1:/home/krypterro/PycharmProjects/corbot# python3 test1.py
 2018-11-03 12:28:22,442 -  INFO -  Application - Start
test1.py:12: DeprecationWarning: use setter for headless property instead of set_headless
  opts.set_headless(headless=True)
Traceback (most recent call last):
  File "test1.py", line 21, in <module>
    main()
  File "test1.py", line 14, in main
    driver = webdriver.Firefox(options=opts) …
Run Code Online (Sandbox Code Playgroud)

firefox selenium python-3.x geckodriver webdriverwait

3
推荐指数
1
解决办法
3851
查看次数

BeautifulSoup中的自定义属性?

我正在尝试使用Beautiful汤来定位具有非标准属性的DIV。这是DIV:

`<div data-asin="099655596X" data-index="1" class="sg-col-20-of-24 s-result-item sg-col-0-of-12 sg-col-28-of-32 sg-col-16-of-20 sg-col sg-col-32-of-36 sg-col-12-of-16 sg-col-24-of-28" data-cel widget="search_result_1">`
Run Code Online (Sandbox Code Playgroud)

我需要使用data-asin属性找到find_all DIV,并同时获取asin。BS似乎支持此功能,但是我正在做的事没有用。这是我的代码不起作用:

`rows = soup.find_all(attrs={"data-asin": "value"})`
Run Code Online (Sandbox Code Playgroud)

我如何在Python3.7中制作BS来查找所有这些DIV?

python beautifulsoup

1
推荐指数
1
解决办法
285
查看次数