开发者

Java, Selenium and getXpathCount

开发者 https://www.devze.com 2023-02-19 22:06 出处:网络
I am using Java to modify Selenium RC test cases. package com.example.tests; import com.thoughtworks.selenium.*;

I am using Java to modify Selenium RC test cases.

package com.example.tests;

import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;

public class TestCase extends SeleneseTestCase {        

    @Test
    public void testLogin() throws Exception {

        selenium.windowMaximize();
        selenium.open("/en/QuoteGenerator.aspx");
        selenium.waitForPageToLoad("30000");
        int r = selenium.getXpathCount("//table[@id='tblDetail']/tbody/tr[.]/td[1]");
        r = r - 2;
}

Eclipse is highlighting this part (selenium.getXpathCount("//table[@id='tblDetail']/tbody/tr[.]/td[1]");) and telling me the following error: "Type mismatch: cannot convert from Number to int".

I've tried using float, long, short, but all were in vain. How do I assign this number to a variable in this c开发者_Python百科ase. Could you please help?


Number result = selenium.getXpathCount("//table[@id='tblDetail']/tbody/tr[.]/td[1]");

int r = result.intValue();
0

精彩评论

暂无评论...
验证码 换一张
取 消