简体   繁体   English

使用WebDriver按字母顺序从表中获取数据

[英]Fetching data from a table alphabetically using webdriver

Is there a way to fetch data from a table alphabetically using webdriver. 有没有一种方法可以使用WebDriver按字母顺序从表中获取数据。

for example: 例如:

a table contains "sno, language, text, link" 一个表包含“ sno,语言,文本,链接”

I would like to know is there away to fetch data alphabetically using language as the column. 我想知道是否可以使用语言作为列按字母顺序获取数据。 Lets say the languages are not alphabetically ordered... Russian, Spanish, English, Chinese... ETC 可以说,语言不是按字母顺序排列的...俄语,西班牙语,英语,中文...等等

Yes you need a DataStructure to store the WebElements which are getting listed while finding elements of table. 是的,您需要一个DataStructure来存储在查找表元素时列出的WebElement。

For Java you can use a DataStructure like HashMap where you can save the link texts as the Key later you can use Collection.sort to sort this DataStructure with the attribute/ column you want. 对于Java,您可以使用像HashMap这样的DataStructure,在其中可以将链接文本另存为Key,以后可以使用Collection.sort对具有所需属性/列的DataStructure进行排序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM