2017-06-16 903 views

回答

0

要清楚,你想執行一個網站目錄複製/粘貼到另一個文件夾?

或者你想解析html內容,並將其保存在外部文件中?

前者並不是真正的硒友好型。

+0

我只是想從一個網站到另一個網站的形式發佈數據,並提交相同。 –

0

所以,你想要什麼一個簡單的例子是這樣的:

網站1:

<span id="spanID"> content in here </span> 

網站2:

<form id="inputID"> [ you want content in here ] </form> 

請注意僞HTML。

你需要爲了使這項工作是做什麼..

browser.get("http://www.website1.com); 

    var tempElement = $("spanID"); 
    tempElement .getText().then(function (contentOfSpan) { 
       console.log(contentOfSpan); // will print the content of the span... now you want to save this value somewhere in your scope. 
    }); 
    ///////////////////////////////////////////////// 
    browser.get("http://www.website2.com); 

    var tempElement = $("inputID"); 
    tempElement.sendKeys(RefferenceTocontentOfSpan)