python selenium选择<div>中的选项

时间:2017-09-10 08:54:10

标签: python selenium

这是我的HTML代码:

<div class="mbot15">
<label class="col-sm-12 control-label">Valley Chrome Size & Style:</label><div class="col-sm-12">
<div style="padding-left:15px">
<select name="c_id[4613]" style="width:200px" id="pr_attributes_4613" class="slickdropdown">
<option value="">Select One</option>
<option value="23464" data-imagesrc="https://www.bigrigchromeshop.com/images/vcRAW/SET_BACK.jpg" data-description="">13&quot; SET BACK AXLE&nbsp;$482.99</option>
<option value="23222" data-imagesrc="https://www.bigrigchromeshop.com/images/SET_BACK.jpg" data-description="">16&quot; SET BACK AXLE&nbsp;$554.99</option>
<option value="23224" data-imagesrc="https://www.bigrigchromeshop.com/images/SET_BACK.jpg" data-description="">18&quot; SET BACK AXLE&nbsp;$574.99</option><option value="23225" data-imagesrc="https://www.bigrigchromeshop.com/images/SET_BACK.jpg" data-description="">20&quot; SET BACK AXLE&nbsp;$799.99</option>
</select><input type="hidden" name="id[4613]" id="id[4613]" value="0"></div>
</div><div class="clearfix"></div></div>

我一直在用

select = Select(driver.find_element_by_xpath("//*[@id='pr_attributes_4613']"))

显示错误

Select only works on <select> elements, not on <div>.

0 个答案:

没有答案