久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用量角器處理基本身份驗證?

How to handle basic authentication with protractor?(如何使用量角器處理基本身份驗證?)
本文介紹了如何使用量角器處理基本身份驗證?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在嘗試量角器在非角度應用程序中編寫一些測試.我必須通過谷歌瀏覽器中的基本身份驗證登錄頁面,但我不知道如何.

I'm trying protractor to write a few tests in a non angular application. I have to login in a page trough basic authentication in google chrome, but i have no idea how.

我已經嘗試過 baseUrl: 'https://username:password@url'capabilities: {瀏覽器名稱":鉻",鉻選項":{參數:['--login-user=foo', '--login-password=bar']}}

但如果這些對我有用,則沒有.有誰知道該怎么做?我在這方面遇到了一些困難.

But none if these worked for me. Anyone knows how to do it? I'm having some hard time on it.

推薦答案

簡短的回答是在 chrome 上沒有簡單的方法,因為它們不支持修改請求標頭 - 請參閱 https://code.google.com/p/selenium/issues/detail?id=141 (標題表示響應標題,但如果您閱讀它,它適用于所有標題).

The short answer is there is no easy way of doing it on chrome because they do not support modifying request headers -- see https://code.google.com/p/selenium/issues/detail?id=141 (title says response headers, but if you read it, it's for all headers).

話雖如此,有辦法做到這一點,盡管很困難.

That being said, there are ways to do it, albeit difficult.

1) 找到一個允許您修改標題的 chrome 擴展/插件.一個簡單的搜索就可以找到很多:https://chrome.google.com/webstore/search/modify%20header.您需要將插件添加到 webdriver:請參閱 量角器測試下是否可以給chromedriver添加插件?.

1) Find a chrome extension/plugin that allows you to modify header. A simple search bring up many of them: https://chrome.google.com/webstore/search/modify%20header. You'll need to add the plugin to webdriver: see Is it possible to add a plugin to chromedriver under a protractor test?.

2) 你可以使用 browsermob-proxy (https://github.com/lightbody/browsermob-代理);這樣,您可以通過代理路由您的流量,這將為您添加標頭.來自文檔:

2) You can use browsermob-proxy (https://github.com/lightbody/browsermob-proxy); this way you route your traffic through the proxy, which would add the headers for you. From the docs:

POST /proxy/[port]/auth/basic/[domain] - Sets automatic basic authentication for the specified domain
Payload data should be json encoded username and password name/value pairs (ex: {"username": "myUsername", "password": "myPassword"}

有一個節點項目可以幫助你,https://github.com/zzo/browsermob-節點,但您仍然需要自己設置代理服務器.

There's a node project that may help you, https://github.com/zzo/browsermob-node, but you would still need to set up your proxy server yourself.

chrome 的兩種方法都很復雜,但都能得到你想要的.(或者你可以堅持使用 Firefox 并按照羅伯特的回答)

Both ways for chrome are complex, but would get you what you want. (or you can stick with firefox and follow Robert's answer)

這篇關于如何使用量角器處理基本身份驗證?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I get my jasmine tests fixtures to load before the javascript considers the document to be quot;readyquot;?(在 javascript 認為文檔“準備好之前,如何讓我的 jasmine 測試裝置加載?) - IT屋-程序員軟件開發技術
What do jasmine runs and waitsFor actually do?(jasmine 運行和等待實際上是做什么的?)
How to provide mock files to change event of lt;input type=#39;file#39;gt; for unit testing(如何提供模擬文件來更改 lt;input type=filegt; 的事件用于單元測試)
How to unit test a chained method using Jasmine(如何使用 Jasmine 對鏈式方法進行單元測試)
How do I inject $rootScope into an AngularJS unit test?(如何將 $rootScope 注入 AngularJS 單元測試?)
Jasmine - How to spy on a function call within a function?(Jasmine - 如何監視函數中的函數調用?)
主站蜘蛛池模板: 日韩精品一区二区三区在线观看 | www免费视频| 国产成人午夜精品影院游乐网 | 久久99精品国产麻豆婷婷 | 久久免费精品 | 久久久久久国产精品免费免费狐狸 | 国产精品亚洲第一 | 国产综合精品一区二区三区 | 国产黄色网址在线观看 | 米奇成人网 | 91亚洲国产成人久久精品网站 | 久久国产成人 | 国精产品一区一区三区免费完 | 欧美一区二区三区精品免费 | 国产精品一区二区不卡 | 男女免费网站 | 欧美日韩成人在线 | 久久精品中文字幕 | 欧美高清视频 | 91亚洲欧美 | 国产精品精品视频一区二区三区 | 日本 欧美 三级 高清 视频 | 中文字幕 在线观看 | 成人在线a| 久久精品一区二区 | 一级免费看 | 狠狠视频 | 国产视频在线观看一区二区三区 | 精品国产欧美一区二区三区成人 | 亚洲精品一区二区网址 | 国产一区二区在线播放视频 | 成年视频在线观看 | 99国产精品一区二区三区 | 国产精品亚洲成在人线 | 日本一二区视频 | 欧美中文 | 亚洲97| 中文字幕亚洲视频 | 一级a毛片 | 成人精品一区二区三区中文字幕 | 欧美寡妇偷汉性猛交 |