开发者

How to select a row based on the color of some column in selenium

开发者 https://www.devze.com 2023-02-13 18:40 出处:网络
I am selecting a row in a loop as its a dynamic table. Now I have to select a value in a drop down of one column based on the bgcolor of another column. Can any one please tell how to do this.

I am selecting a row in a loop as its a dynamic table. Now I have to select a value in a drop down of one column based on the bgcolor of another column. Can any one please tell how to do this.

Following is the html of td

<td bgcolor="#ffbf00" align="center" width="12px" style="border: 2px solid rgb(0, 0, 0);" class="whitetext" id="cars_0开发者_运维问答_tbl_Price_0_0">  4</td>

or

<td bgcolor="Green" align="center" width="12px" style="border: 2px solid rgb(0, 0, 0);" class="whitetext" id="cars_2_tbl_Price_0_0"> 23</td>

and following is the html of td that i want to select based on the value of previous td

<select style="width: 180px;" class="dropdowncommon" id="engine">


You can find the following code helpful.

if (selenium.getAttribute("td@bgcolor").equalsIgnoreCase("Green")){

   // Perform desired action
}          
0

精彩评论

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