第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Django Jenkins處理到Selenium服務(wù)器時(shí)引發(fā)WebDriverException

Django Jenkins處理到Selenium服務(wù)器時(shí)引發(fā)WebDriverException

胡說(shuō)叔叔 2021-03-22 14:19:52
我通過(guò)命令啟動(dòng)Selenium服務(wù)器中心java -jar selenium-server-standalone-2.33.0.jar -role hub和Selenium服務(wù)器節(jié)點(diǎn)通過(guò)命令java -jar selenium-server-standalone-2.33.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=htmlunit然后我試圖執(zhí)行代碼:from selenium import webdriverfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilitiesserver =  'http://localhost:4444/wd/hub'dc = DesiredCapabilities.HTMLUNITbrowser = webdriver.Remote(server, dc)browser.get('http://localhost:8000')之后一切都還好。但是,當(dāng)我嘗試開(kāi)始進(jìn)行詹金斯測(cè)試時(shí):from django.test import TestCase, LiveServerTestCasefrom selenium.webdriver.common import proxyfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilitiesfrom selenium.webdriver.remote.webdriver import WebDriverclass SeleniumTest(LiveServerTestCase):    @classmethod    def setUpClass(cls):        p = proxy.Proxy({        'proxyType': proxy.ProxyType().MANUAL,        'httpProxy': '127.0.0.1:4444',        })        capabilities = DesiredCapabilities().HTMLUNIT        cls.selenium = WebDriver(desired_capabilities=capabilities, proxy=p)        super(SeleniumTest, cls).setUpClass()    @classmethod    def tearDownClass(cls):        cls.selenium.quit()        super(SeleniumTest, cls).tearDownClass()    def test_javascript_basket(self):        self.selenium.get('http://localhost:8000')我收到以下錯(cuò)誤,包含在追溯中:WebDriverException:消息:u'\ n \ n \ n錯(cuò)誤:無(wú)法檢索到所請(qǐng)求的URL \ n \ n \ n \ n錯(cuò)誤\ n所請(qǐng)求的網(wǎng)址無(wú)法檢索\ n \ n\ n \ n \ n嘗試檢索URL時(shí)遇到以下錯(cuò)誤:a href =“ http:// localhost:4444 / wd / hub / session” localhost:4444 / wd / hub / session ap \ n \ n \ n與127.0.0.1的連接失敗。\ n\ n \ n系統(tǒng)返回:(111)連接被拒絕\ n \ n遠(yuǎn)程主機(jī)或網(wǎng)絡(luò)可能已關(guān)閉。請(qǐng)重試該請(qǐng)求。\ n \ n您的緩存管理員是網(wǎng)站管理員。\ n \ n\ n \ n \ n\ n \ n由localhost(squid / 3.1.6)于2013年6月10日星期一格林尼治標(biāo)準(zhǔn)時(shí)間生成\ n \ n \ n'這是怎么回事?為什么從Jenkins測(cè)試連接到Selenium服務(wù)器無(wú)法正常工作?python==2.7.3Django==1.5django-jenkins==0.14.0selenium==2.33.0
查看完整描述

1 回答

?
MMMHUHU

TA貢獻(xiàn)1834條經(jīng)驗(yàn) 獲得超8個(gè)贊

我以這種方式解決了問(wèn)題(使用了phantom-js而不是HTMLUNIT,因?yàn)樗俏ㄒ皇S嗟姆€(wěn)定版本的代碼)。


from django.test import LiveServerTestCase

from selenium import webdriver

from os import environ



class SeleniumTestCase(LiveServerTestCase):

    __test__ = False    


    @classmethod

    def setUpClass(cls):

        environ['NO_PROXY'] = '127.0.0.1'  # The key point


        cls.selenium = webdriver.PhantomJS(service_args=['--proxy-type=none'])    

        super(SeleniumTestCase, cls).setUpClass()


    @classmethod

    def tearDownClass(cls):

        cls.selenium.close()

        cls.selenium.quit()

        super(SeleniumTestCase, cls).tearDownClass()



class TestFoo(SeleniumTestCase):    

    def setUp(self):

        # do something before every test method runs

        pass

    def test_foo(self):

        # test

        pass


查看完整回答
反對(duì) 回復(fù) 2021-03-31
  • 1 回答
  • 0 關(guān)注
  • 169 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)