Selenium webdriver 如何在selenium Webdriver中复制和粘贴内容?

Selenium webdriver 如何在selenium Webdriver中复制和粘贴内容?,selenium-webdriver,Selenium Webdriver,有谁能指导我如何在selenium WebDriver的帮助下从一个站点复制内容并迁移到另一个站点吗?请澄清,您想将网站目录复制/粘贴到另一个文件夹吗 还是要解析html内容并将其保存在外部文件中 前者不是真正的硒友好型。因此,您想要的一个简单示例是: 网站1: <span id="spanID"> content in here </span> 我只想发布数据从一个网站到另一个网站的形式,并提交相同的。 <form id="inputID">

有谁能指导我如何在selenium WebDriver的帮助下从一个站点复制内容并迁移到另一个站点吗?

请澄清,您想将网站目录复制/粘贴到另一个文件夹吗

还是要解析html内容并将其保存在外部文件中


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

因此,您想要的一个简单示例是:

网站1:

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

我只想发布数据从一个网站到另一个网站的形式,并提交相同的。
    <form id="inputID"> [ you want content in here ] </form>
  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)