URL-https://www.etmoney.com/mutual-funds/equity/focused/77
在特定的网站上,我必须避开所有的基金规模,并将所有规模相加,稍后使用TestNG断言进行比较. 挑战在于基金规模有多个分隔符(₹和空格)3分隔符
对于ex:(刮刮基金规模)
₹110CRS
₹8,696个CRS
₹3,460个CR
₹711CRS
₹5,990 CRS
₹26,218 CRS
₹7,907 CRS
₹1,780个CRS
₹956 CRS
₹1,708个CR
₹1,330 CRS
₹5,825 CRS
₹18,712 CRS
最终输出类似于
110
8696
3460
711
5990
26218
7907
1780
956
1708
1330
5825
18712
int total = 0;
List<WebElement> totalFunds = driver.findElements(By.xpath("//div[@class='card-bordy']/div/div/div/div/div[2]/div/div/div[2]/div/p[2]"));
for(int i=0;i<totalFunds.size();i++) {
String funds = totalFunds.get(i).getText();
String fu = funds.split(" ")[0];
System.out.println(fu.split("₹")[1]);
错误-"java.lang.ArrayIndexOutOf边界异常:索引%1超出长度%1的界限"