伙计们,我有一个清单,像这样
my_list = ["Number Of Request","Req. Staff Name","Req. Org Name","Use Area","IP Address","MAC Address","Request Time Slot","Reason","Asset Num","Email to be notified (separated by semicolon)","Description","Form Number",.....]
这样的HTML
<div id="QueryContent" style="box-shadow: 4px 4px 3px rgba(20%,20%,40%,0.5);">
......
<tr class="table_tr">
<td class="table_td_rows_label_not_botton">
<span id="ctl00_ContentPlaceHolder1_ASPxSplitter1_lblReqNumber">Number Of Request</span>
<span id= .........
</td>.....
<tr class="table_tr">
<td class="table_td_rows_label_not_botton">
<span id="ctl00_ContentPlaceHolder1_ASPxSplitter1_lblReqStaffTitle">Req. Staff Name</span>
<span id= .........
</td>....
,我想使用for循环来断言元素文本在列表中。 我该怎么办?
我正在尝试使用此
grids = driver.find_elements_by_css_selector("div#QueryContent>table>tbody>tr>td>span:nth-child(1)");
grids_text = [grid.text for grid in grids]
但是我不知道如何断言。我是用python编写硒测试的新手。