这是我第一次尝试使用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脚本:
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) 我在带有 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) 我的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)