标签: iceweasel

在Raspberry Pi无头上使用Selenium

这是我第一次尝试使用Iceweasel浏览器在树莓派上运行Selenium.我今晚尝试了一个简单的测试

# selenium test for /mod2 
# verify: posts, and page name
class TestMod2Selenium(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()

    def test_validate_page_elements(self):
        driver = self.driver
        driver.get("127.0.0.1:5000/mod2")
        self.assertIn("Home - microblog", driver.title)
    def tearDown(self):
        self.driver.close()
Run Code Online (Sandbox Code Playgroud)

我在运行时得到的错误是:

=====================================================================
ERROR: test_validate_page_elements (__main__.TestMod2Selenium)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 58, in setUp
    self.driver = webdriver.Firefox()
  File "/home/pi/naughton_python/flask/flask/local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
    self.binary, timeout),
  File "/home/pi/naughton_python/flask/flask/local/lib/python2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/home/pi/naughton_python/flask/flask/local/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 61, in launch_browser
    self._wait_until_connectable()
  File "/home/pi/naughton_python/flask/flask/local/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 100, in _wait_until_connectable …
Run Code Online (Sandbox Code Playgroud)

python selenium raspberry-pi iceweasel

16
推荐指数
2
解决办法
2万
查看次数

Selenium Firefox webdriver适用于从Ubuntu构建的图像,但不适用于使用Debian构建的图像

这是我遇到的一个非常奇怪的情况.我有以下简单的Python脚本:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options


options = Options()
options.add_argument("-headless")
browser = webdriver.Firefox(firefox_options=options)
browser.get("https://www.google.com")
print(browser.current_url)
Run Code Online (Sandbox Code Playgroud)

和脚本的包装:

#!/bin/bash

wget https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz
tar -xzvf geckodriver-v0.19.1-linux64.tar.gz
chmod 777 geckodriver
mv geckodriver /usr/bin/
firefox -v
# python3 when ubuntu
python test.py 
Run Code Online (Sandbox Code Playgroud)

另外我有两个Dockerfiles:

Dockerfile A(Ubuntu;工作正常):

FROM ubuntu:16.04
RUN apt-get update -y && apt-get install -y python3 \
        python3-pip \
        firefox \
        build-essential \
        wget
COPY . /app
WORKDIR /app
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
ENTRYPOINT ["bash"]
CMD ["test_wrapper.sh"] …
Run Code Online (Sandbox Code Playgroud)

python debian selenium docker iceweasel

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

当我在 CSS 中指定“Liberation Mono”时,为什么会选择“DejaVu Serif”?

我在带有 XFCE4 桌面的 Debian 系统上使用 Iceweasel 浏览器(Firefox 衍生版本)。

我没有在 ~/.config/fontconfig/fonts.conf 中定义任何自定义字体替换。

这是 fc-match 目前告诉我的。

lone@debian:~$ fc-match "Liberation Mono"
n022003l.pfb: "Nimbus Mono L" "Regular"
lone@debian:~$ fc-match Courier
n022003l.pfb: "Nimbus Mono L" "Regular"
lone@debian:~$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
Run Code Online (Sandbox Code Playgroud)

因此,我希望当我有 HTML 时,使用“Liberation Mono”字体应该提供与使用“Courier”相同的结果。但从下面的屏幕截图中可以看出,情况并非如此(JSFiddle: http: //jsfiddle.net/8L3rmyxn/)。

在此输入图像描述

我单击“检查元素”并找到实际使用的字体。

对于CSS中使用“Liberation Mono”的文本,浏览器使用“DejaVu Serif”代替,这与fc-math的输出不一致。

对于 CSS 中使用“Courier”的文本,浏览器使用“Nimbus Mono L”,这与 fc-match 的输出一致。

对于 CSS 中使用“monospace”的文本,浏览器使用“DejaVu Sans Mono”,这再次与 fc-match 的输出一致。

问题

为什么在“Liberation Mono”字体的情况下,浏览器不使用“Nimbus Mono L”而是使用“DejaVu Serif”字体?

已知分辨率

请注意,我知道解决此问题的方法。如果我在 ~/.config/fontconfig/fonts.conf 中明确定义“Liberation Mono”的别名,那么我会得到所需的结果,即“Liberation Mono”字体中的文本和“Courier”字体中的文本看起来相似。

lone@debian:~$ cat ~/.config/fontconfig/fonts.conf 
<?xml …
Run Code Online (Sandbox Code Playgroud)

css firefox fonts iceweasel

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

Proxychains无法在kali linux上找到文件

我的kali linux和proxychains有问题:它输出以下错误.它似乎无法找到exec的引用指针或exec有错误的信息.

我已经检查了resolv.conf文件,一切似乎都没问题,而且proxychains.conf文件似乎运行正常.我尝试过多个dns服务器但是会出现相同的错误.

有人有任何解决方案?命令行输出:

 root@kali:~# proxychains iceweasel www.google.com
 ProxyChains-3.1 (http://proxychains.sf.net)
 |DNS-request| www.google.com 
 can't exec proxyresolv: No such file or directory
 |DNS-response|: www.google.com is not exist
 |DNS-request| www.google.com 
 can't exec proxyresolv: No such file or directory
 |DNS-response|: www.google.com is not exist
Run Code Online (Sandbox Code Playgroud)

linux dns proxy iceweasel

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

标签 统计

iceweasel ×4

python ×2

selenium ×2

css ×1

debian ×1

dns ×1

docker ×1

firefox ×1

fonts ×1

linux ×1

proxy ×1

raspberry-pi ×1