• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python webserver.SimpleWebServer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中selenium.test.selenium.webdriver.common.webserver.SimpleWebServer的典型用法代码示例。如果您正苦于以下问题:Python SimpleWebServer类的具体用法?Python SimpleWebServer怎么用?Python SimpleWebServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SimpleWebServer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    FirefoxSelectElementHandlingTests.webserver = webserver
    capabilities = {'marionette': False}
    FirefoxSelectElementHandlingTests.driver = webdriver.Firefox(
        capabilities=capabilities)
开发者ID:Alsan,项目名称:selenium,代码行数:7,代码来源:ff_select_support_class_tests.py


示例2: setup_module

def setup_module(module):
    utils.start_server(module)
    webserver = SimpleWebServer()
    webserver.start()
    RemoteAdvancedUserInteractionTest.webserver = webserver
    RemoteAdvancedUserInteractionTest.driver = \
        webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.FIREFOX)
开发者ID:chromium-googlesource-mirror,项目名称:selenium,代码行数:7,代码来源:test_remote_interactions.py


示例3: setup_module

def setup_module(module):
  _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  url = "http://%s:%d/wd/hub" % (SERVER_ADDR, DEFAULT_PORT)
  try:
    _socket.connect((SERVER_ADDR, DEFAULT_PORT))
    print ("The remote driver server is already running or something else"
           "is using port %d, continuing..." % DEFAULT_PORT)
  except:
    print ("Starting the remote driver server")
    AuthenticatedServerTest.server_proc = subprocess.Popen(
        "java -jar build/java/server/test/org/openqa/selenium/remote/server/auth/server-standalone.jar",
        shell=True)
    assert wait_for_server(url, 10), "can't connect"
    print "Server should be online"
  
  webserver = SimpleWebServer()
  webserver.start()
  AuthenticatedServerTest.webserver = webserver
开发者ID:Hemkumar,项目名称:selenium,代码行数:18,代码来源:test_remote_authenticated_server.py


示例4: setup_module

def setup_module(module):
    _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    url = "http://%s:%d/wd/hub" % (SERVER_ADDR, DEFAULT_PORT)
    try:
        _socket.connect((SERVER_ADDR, DEFAULT_PORT))
        print ("The remote driver server is already running or something else"
               "is using port %d, continuing..." % DEFAULT_PORT)
    except:
        print ("Starting the remote driver server")
        RemoteVisibilityTests.server_proc = subprocess.Popen(
            "java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar",
            shell=True)

        assert wait_for_server(url, 10), "can't connect"
        print "Server should be online"

    webserver = SimpleWebServer()
    webserver.start()
    RemoteVisibilityTests.webserver = webserver
    RemoteVisibilityTests.driver = webdriver.Remote(browser_name="firefox", platform="ANY")
开发者ID:PolicyStat,项目名称:selenium-old,代码行数:20,代码来源:test_remote_visibility_tests.py


示例5: setup_module

def setup_module(module):
    _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    url = "http://%s:%d/wd/hub" % (SERVER_ADDR, DEFAULT_PORT)
    try:
        _socket.connect((SERVER_ADDR, DEFAULT_PORT))
        print ("The remote driver server is already running or something else"
               "is using port %d, continuing..." % DEFAULT_PORT)
    except:
        print ("Starting the remote driver server")
        RemoteTypingTests.server_proc = subprocess.Popen(
            "java -jar build/remote/server/server-standalone.jar",
            shell=True)

        assert wait_for_server(url, 10), "can't connect"
        print "Server should be online"

    webserver = SimpleWebServer()
    webserver.start()
    RemoteTypingTests.webserver = webserver
    RemoteTypingTests.driver = webdriver.Remote(desired_capabilities = webdriver.DesiredCapabilities.FIREFOX)
开发者ID:Escobita,项目名称:selenium,代码行数:20,代码来源:test_remote_typing_keys.py


示例6: setup_method

class TestOptions:

    def setup_method(self, method):
        self.webserver = SimpleWebServer()
        self.webserver.start()

    def test_we_can_pass_options(self):
        capabilities = {'marionette': True}
        options = Options()
        self.driver = webdriver.Firefox(
            capabilities=capabilities,
            firefox_options=options)
        self.driver.get(self.webserver.where_is('formPage.html'))
        self.driver.find_element_by_id("cheese")

    def teardown_method(self, method):
        try:
            self.driver.quit()
        except:
            pass  # Don't care since we may have killed the browser above
        self.webserver.stop()
开发者ID:AkosLukacs,项目名称:selenium,代码行数:21,代码来源:mn_options_tests.py


示例7: setup_method

class TestFirefoxProfile:
    
    def setup_method(self, method):
        self.driver = webdriver.Firefox() 
        self.webserver = SimpleWebServer()
        self.webserver.start()

    def test_that_we_can_accept_a_profile(self):
        self.profile1 = webdriver.FirefoxProfile()
        self.profile1.set_preference("startup.homepage_welcome_url", 
            "%s" % "http://localhost:%d/%s.html" % (self.webserver.port, "simpleTest"))
        self.profile1.update_preferences()

        self.profile2 = webdriver.FirefoxProfile(self.profile1.path)
        self.driver = webdriver.Firefox(firefox_profile=self.profile2)
        title = self.driver.title
        assert "Hello WebDriver" == title

    def test_that_we_delete_the_profile(self):
        path = self.driver.firefox_profile.path
        self.driver.quit()
        assert not os.path.exists(path)

    def teardown_method(self, method):
        try:
            self.driver.quit()
        except:
            pass #don't care since we may have killed the browser above
        self.webserver.stop()

    def _pageURL(self, name):
        return "http://localhost:%d/%s.html" % (self.webserver.port, name)

    def _loadSimplePage(self):
        self._loadPage("simpleTest")

    def _loadPage(self, name):
        self.driver.get(self._pageURL(name))
开发者ID:j0hnsmith,项目名称:Selenium2,代码行数:38,代码来源:test_ff_profile_tests.py


示例8: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    ChromeElementAttributeTests.webserver = webserver
    ChromeElementAttributeTests.driver = webdriver.Chrome()
开发者ID:Escobita,项目名称:selenium,代码行数:5,代码来源:test_chrome_element_attribute.py


示例9: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    FirefoxTypingTests.webserver = webserver
    FirefoxTypingTests.driver = webdriver.Firefox()
开发者ID:Escobita,项目名称:selenium,代码行数:5,代码来源:test_ff_typing_tests.py


示例10: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    FirefoxSelectElementHandlingTests.webserver = webserver
    FirefoxSelectElementHandlingTests.driver = webdriver.Firefox()
开发者ID:DreamYa0,项目名称:PythonProject,代码行数:5,代码来源:ff_select_support_class_tests.py


示例11: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    FirefoxWebDriverWaitTest.webserver = webserver
    FirefoxWebDriverWaitTest.driver = webdriver.Firefox()
开发者ID:chromium-googlesource-mirror,项目名称:selenium,代码行数:5,代码来源:ff_explicit_wait_tests.py


示例12: setup_module

def setup_module(module):
    
    webserver = SimpleWebServer(host=get_lan_ip())
    webserver.start()
    FirefoxStaleReferenceTests.webserver = webserver
    FirefoxStaleReferenceTests.driver = webdriver.Firefox()
开发者ID:RestoreDemocracy,项目名称:selenium-friends-scraper,代码行数:6,代码来源:ff_stale_reference_tests.py


示例13: setup_module

def setup_module(module):
    utils.start_server(module)
    webserver = SimpleWebServer()
    webserver.start()
    RemoteCookieTest.webserver = webserver
    RemoteCookieTest.driver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.FIREFOX)
开发者ID:chromium-googlesource-mirror,项目名称:selenium,代码行数:6,代码来源:test_remote_cookie.py


示例14: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    IeCorrectEventFiringTests.webserver = webserver
    IeCorrectEventFiringTests.driver = webdriver.Ie()
开发者ID:Escobita,项目名称:selenium,代码行数:5,代码来源:test_ie_correct_event_firing.py


示例15: setup_module

def setup_module(module):
    
    webserver = SimpleWebServer(host=get_lan_ip())
    webserver.start()
    FirefoxElementEqualityTests.webserver = webserver
    FirefoxElementEqualityTests.driver = webdriver.Firefox()
开发者ID:RestoreDemocracy,项目名称:selenium-friends-scraper,代码行数:6,代码来源:ff_element_equality_tests.py


示例16: setup_method

class TestFirefoxProfile:

    def setup_method(self, method):
        self.driver = webdriver.Firefox()
        self.webserver = SimpleWebServer()
        self.webserver.start()

    def test_that_we_can_accept_a_profile(self):
        profile1 = webdriver.FirefoxProfile()
        profile1.set_preference("startup.homepage_welcome_url",
            self.webserver.where_is('simpleTest.html'))
        profile1.update_preferences()

        profile2 = webdriver.FirefoxProfile(profile1.path)
        driver = webdriver.Firefox(firefox_profile=profile2)
        title = driver.title
        driver.quit()
        assert "Hello WebDriver" == title

    def test_that_prefs_are_written_in_the_correct_format(self):
        # The setup gave us a browser but we dont need it
        self.driver.quit()

        profile = webdriver.FirefoxProfile()
        profile.set_preference("sample.preference", "hi there")
        profile.update_preferences()

        assert 'hi there' == profile.default_preferences["sample.preference"]

        encoded = profile.encoded
        decoded = base64.decodestring(encoded)
        fp = BytesIO(decoded)
        zip = zipfile.ZipFile(fp, "r")
        for entry in zip.namelist():
            if entry.endswith("user.js"):
                user_js = zip.read(entry)
                for line in user_js.splitlines():
                    if line.startswith(b'user_pref("sample.preference",'):
                        assert True == line.endswith(b'hi there");')
            # there should be only one user.js
            break
        fp.close()

    def test_that_unicode_prefs_are_written_in_the_correct_format(self):
        # The setup gave us a browser but we dont need it
        self.driver.quit()

        profile = webdriver.FirefoxProfile()
        profile.set_preference('sample.preference.2', unicode('hi there'))
        profile.update_preferences()

        assert 'hi there' == profile.default_preferences["sample.preference.2"]

        encoded = profile.encoded
        decoded = base64.decodestring(encoded)
        fp = BytesIO(decoded)
        zip = zipfile.ZipFile(fp, "r")
        for entry in zip.namelist():
            if entry.endswith('user.js'):
                user_js = zip.read(entry)
                for line in user_js.splitlines():
                    if line.startswith(b'user_pref("sample.preference.2",'):
                        assert True == line.endswith(b'hi there");')
            # there should be only one user.js
            break
        fp.close()

    def test_that_integer_prefs_are_written_in_the_correct_format(self):
        # The setup gave us a browser but we dont need it
        self.driver.quit()

        profile = webdriver.FirefoxProfile()
        profile.set_preference("sample.int.preference", 12345)
        profile.update_preferences()
        assert 12345 == profile.default_preferences["sample.int.preference"]

    def test_that_boolean_prefs_are_written_in_the_correct_format(self):
        # The setup gave us a browser but we dont need it
        self.driver.quit()

        profile = webdriver.FirefoxProfile()
        profile.set_preference("sample.bool.preference", True)
        profile.update_preferences()
        assert True == profile.default_preferences["sample.bool.preference"]

    def test_that_we_delete_the_profile(self):
        path = self.driver.firefox_profile.path
        self.driver.quit()
        assert not os.path.exists(path)

    def test_profiles_do_not_share_preferences(self):
        self.profile1 = webdriver.FirefoxProfile()
        self.profile1.accept_untrusted_certs = False
        self.profile2 = webdriver.FirefoxProfile()
        # Default is true. Should remain so.
        assert self.profile2.default_preferences["webdriver_accept_untrusted_certs"] == True

    def test_none_proxy_is_set(self):
        # The setup gave us a browser but we dont need it
        self.driver.quit()
#.........这里部分代码省略.........
开发者ID:217,项目名称:selenium,代码行数:101,代码来源:ff_profile_tests.py


示例17: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    ChromeImplicitWaitTest.webserver = webserver
    ChromeImplicitWaitTest.driver = webdriver.Chrome()
开发者ID:Escobita,项目名称:selenium,代码行数:5,代码来源:test_chrome_implicit_waits.py


示例18: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    FirefoxRenderedWebElementTests.webserver = webserver
    FirefoxRenderedWebElementTests.driver = webdriver.Firefox()
开发者ID:Escobita,项目名称:selenium,代码行数:5,代码来源:test_ff_rendered_webelement.py


示例19: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    ChromeTextHandlingTests.webserver = webserver
    ChromeTextHandlingTests.driver = webdriver.Chrome()
开发者ID:Escobita,项目名称:selenium,代码行数:5,代码来源:test_chrome_text_handling_tests.py


示例20: setup_module

def setup_module(module):
    webserver = SimpleWebServer()
    webserver.start()
    IeDriverElementFindingTests.webserver = webserver
    IeDriverElementFindingTests.driver = webdriver.Ie()
开发者ID:Escobita,项目名称:selenium,代码行数:5,代码来源:test_ie_driver_element_finding.py



注:本文中的selenium.test.selenium.webdriver.common.webserver.SimpleWebServer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python webdriver.ActionChains类代码示例发布时间:2022-05-27
下一篇:
Python selenium.selenium函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap