java - For loop causing error in Junit with Selenium while searching data in a column -
java - For loop causing error in Junit with Selenium while searching data in a column -
i m getting error next loop in junit3
for(int i=9;i<=58;i++) { x = selenium.gettable("//table[4].".i.".6"); if(x == "single" || x = "onetomany") { found="true"; } else break; }
can solve problem m going wrong in advance
is code java code?
as @matt-ball said, instead of
if(x == "single" || x = "onetomany")
should be
if ("single".equals(x) || "onetomany".equals(x))
note, in java should not compare string ==
, should utilize equals()
instead.
also next code looks unusual me:
x = selenium.gettable("//table[4].".i.".6");
is string concatenation? looks php code. think in java should this:
x = selenium.gettable("//table[4]." + + ".6");
or
x = selenium.gettable("//table[4]." + string.valueof(i) + ".6");
or
x = selenium.gettable(string.format("//table[4].%d.6", i);
java
Comments
Post a Comment