我如何獲得項目 - mar3已被授予另一位遊客。下面提供的html
文字?如何獲取此元素的文本
我的腳本。
package garbage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class mailinator {
static WebDriver driver;
public static void main(String args[])
{
driver=new FirefoxDriver();
driver.get("http://www.mailinator.com/inbox.jsp?to=679jcscqgtm1guuq09aef3mofu");
driver.findElement(By.xpath("//*[normalize-space(text())='Item awarded']")).click();
// driver.switchTo().frame("rendermail");
System.out.println(driver.findElement(By.xpath("html/body/div[1]/div/div/table[1]/tbody/tr/td[2]/div/table/tbody/tr/td/p[3]")).getText().trim());
}
}
而且,HTML
<p>
Item -
<b>mar3</b>
has been awarded to another traveler.
</p>
而且,還像here
請提供'html'以及您嘗試過的代碼。 – Saifur 2015-03-02 20:10:52
請避免提供圖片鏈接並將相關HTML作爲文本發佈到問題中。 – alecxe 2015-03-02 20:11:11
問題更新 – 2015-03-02 20:15:03