小编use*_*258的帖子

在运行时期间突出显示WebDriver中的元素

有人可以帮忙!

如何在WebDriver的测试执行期间突出显示以下类中的所有Web元素?使用Selenium RC,它非常直接但是使用WebDriver我很挣扎.

如果有人可以请我提供一些我可以尝试的代码,我将不胜感激,这些代码也适合下面的课程 - 对不起,我的Java技能并不是那么好.

package hisScripts;
import java.util.concurrent.TimeUnit;
import org.testng.annotations.*;
import org.testng.Assert;
import static org.testng.Assert.fail;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.interactions.Actions;


public class R_LHAS_Only_Account_Verification extends HIS_Login_Logout{
    public WebDriver driver;
    public String baseUrl;
    public int exeMonth;
    private StringBuffer verificationErrors = new StringBuffer();

    @BeforeClass
    @Parameters ({"browser1", "url", "executionMonth"})
    public void setUp(String browser1, String url, int executionMonth) throws Exception {
        exeMonth = executionMonth;
        baseUrl = url;

        if (browser1.equals("FF")) {
            driver = new FirefoxDriver();
        } else if (browser1.equals("IE")){
            driver = …
Run Code Online (Sandbox Code Playgroud)

java selenium webdriver

16
推荐指数
2
解决办法
6万
查看次数

无法在端口7055上连接到主机127.0.0.1

我是webdriver的新手,需要一些帮助..

我在Windows XP上使用Selenium 2.2.0和FF v7.0.1

我已经成功地在IE中记录并回放了一个java脚本,但每当我尝试在FF中执行相同的脚本时,我收到以下错误消息:

45000 ms后无法在端口7055上连接到主机127.0.0.1

我已经阅读了很多地方,如果我将firefox版本降级到3.6脚本将工作正常,但我不想热衷于降级.有人可以告诉我我做错了什么吗?

package hisScripts;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;


public class WebdriverTest_1 {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    //driver=new InternetExplorerDriver();
    baseUrl = "https://**********/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

@Test
public void testUntitled() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.xpath("//a[contains(text(),'my profile')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'about the service')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'contact us')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'help')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'home')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'logout')]")).click();

}

@After
public …
Run Code Online (Sandbox Code Playgroud)

webdriver

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

webdriver ×2

java ×1

selenium ×1