我在Django应用程序聊天中有以下代码
from channels.testing import ChannelsLiveServerTestCase
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.wait import WebDriverWait
class ChatTests(ChannelsLiveServerTestCase):
serve_static = True # emulate StaticLiveServerTestCase
@classmethod
def setUpClass(cls):
super().setUpClass()
try:
# NOTE: Requires "chromedriver" binary to be installed in $PATH /home/muiruri_samuel/webapp/chatenv/lib/python3.6/site-packages/
cls.driver = webdriver.Chrome(executable_path="/home/muiruri_samuel/webapp/chatsys/chat/chromedriver")
except:
super().tearDownClass()
raise
...
应该检查一下!如果通道工作正常,但在此之前无法连接到ChromeDriver
^{pr2}$它“找不到”路径/home/muiruri_samuel/webapp/chatsys/chat/chromedriver
上的驱动程序,我也尝试过将其复制到sites包/home/muiruri_samuel/webapp/chatenv/lib/python3.6/site-packages/
根据
muiruri_samuel@train:~/webapp/chatsys$ python manage.py test chat.tests
命令,您正在运行文件夹webapp/chatsys
中的代码。 所以它将是一个工作目录。因此它不会在子目录中找到chromedriver
,包括./chat
。 例如,尝试将chromedriver
移动到/usr/bin
。 并确保它在PATH
变量中:echo $PATH
相关问题 更多 >
编程相关推荐