Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98814

Need to convert list into String array for string comparison

$
0
0

Target : I want to compare list of country code corresponding country name which is in Excel. Excel sheet have country code and country name in each column separated by ","(comma). I have taken this through below code.

String codes= hashmap.get("Country code"+i);
String countryname=hashmap.get("Country Name"+i);
String[] eachCNCODE= codes.split(",");
String[] eachCountry=countryname.split(",");

eachCNCODE & eachCountry arrays has the content of expected. Now i want to compare this with the content in webpage. so i have take webpage elements for countrycode & country name as below using List.

List<WebElement> countrycodes=driver.findElements(By.xpath("//*[@id='TBL_QryRslts']/tbody/tr/td[4")
List<WebElement> countryNames=driver.findElements(By.xpath("//*[@id='TBL_QryRslts']/tbody/tr/td[5]/div/a")

Now I want to compare eachCNCODE with countrycodes. Want to convert List<WebElement> into String array then I want to compare each . Please help me on this


Viewing all articles
Browse latest Browse all 98814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>