2016-08-19 40 views
0

我是Robot Framework的新手,但想詢問是否可以啓用啓用CORS的Chrome實例?使用Robot Framework使用CORS啓動chrome實例

Run process open -n -a /Applications/Google\ Chrome.app/ --args --user-data-dir=/tmp/chrome_dev_session --disable-web-security --allow-running-insecure-content --new-window 

我已經嘗試了以上,但運行

Keyword 'Process.Run Process' got positional argument after named arguments.

我自己也嘗試沒有參數

Run process open -n -a /Applications/Google\ Chrome.app/ --args --user-data-dir=/tmp/chrome_dev_session --disable-web-security --allow-running-insecure-content --new-window 

但是得到了以下的雙間距時,不幸的是得到一個錯誤錯誤

Keyword 'Process.Run Process' expected at least 1 non-keyword argument, got 0. 

任何幫助,將不勝感激。

感謝

回答

0

因爲我沒有測試,以驗證您的使用情況下,我只是要分享簡短調查的一些結果。

您啓動Chrome運行測試的方式不正確。在StackOverflow上,關於Chrome的類似問題持有fine example關於如何啓動Chrome的特定設置。例如代理。

使用這一機制應該是可以設置您的具體參數,像這樣:

*** Settings *** 
Library   Selenium2Library 

*** Test Cases *** 
Stackoverflow 
    ${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver 
    Call Method ${options} add_argument  disable-web-security 
    Call Method ${options} add_argument  allow-running-insecure-content 
    Call Method ${options} add_argument  user-data-dir=/tmp/chrome_dev_session 
    Create WebDriver Chrome chrome_options=${options} 
    Go To https://www.java.com/verify 
    Close All Browsers 

這應該允許您與您的需要進行本地測試的具體設置Chrome啓動。