1
我無法簡化下面的多個表格中包含元素的selenium CSS代碼。下面的代碼給了我兩個複選框。如何縮短表格元素的長Selenium CSS代碼?
table[id$=gridReports]>tbody>tr:nth-of-type(2)>td:nth-of-type(2)>table[id$=panelReportInformation]>tbody>tr:nth-of-type(2)>td>table[id$=panelReportContent]>tbody>tr:nth-of-type(2)>span[id$=reportCheckBox] input
我不能使用此代碼,因爲還有另一個具有相同跨度和複選框的表。唯一的區別是它在不同的行中。所以,如果我把另一個複選框的代碼,它會看起來像這樣。
table[id$=gridReports]>tbody>tr:nth-of-type(3)>td:nth-of-type(2)>table[id$=panelReportInformation]>tbody>tr:nth-of-type(2)>td>table[id$=panelReportContent]>tbody>tr:nth-of-type(2)>span[id$=reportCheckBox] input
因此,唯一的區別是第n的類型爲每個表(i)中。那麼我怎樣才能縮短CSS代碼呢?
是否有任何選項可以像表格[id $ = gridReports]> tbody> tr:nth-type(i),然後是span [id $ = reportCheckBox]輸入。
任何幫助,將不勝感激。
感謝