【发布时间】:2021-11-15 02:21:37
【问题描述】:
<div class="et_pb_button_module_wrapper et_pb_button_4_tb_header_wrapper et_pb_button_alignment_center et_pb_button_alignment_phone_center et_pb_module ">
<a class="et_pb_button et_pb_button_4_tb_header full-width-btn et_hover_enabled et_pb_bg_layout_light" href="https://pegramonline.com/compare-insurance-companies-charlotte-nc/">Get a Quote</a>
</div>
我试图找到 <a> 元素,但仍然找不到它。请有其他建议...类名有空格
By.cssSelector(“a[class='et_pb_button et_pb_button_4_tb_header full-width-btn et_hover_enabled et_pb_bg_layout_light']”);
By.cssSelector(“a.et_pb_button.et_pb_button_4_tb_header.full-width-btn.et_hover_enabled.et_pb_bg_layout_light”);
By.xpath(“//a[contains(@class, 'et_pb_button') and contains(@class, 'et_pb_button_4_tb_header') and contains(@class, 'full-width-btn') 并且包含(@class, 'et_hover_enabled') 和包含(@class, 'et_pb_bg_layout_light')]”);
【问题讨论】:
标签: selenium-webdriver css-selectors