سؤال

How can I click the link:

<a class="single_like_button btn3-wrap" onclick="openFbLWin_189932();">
<span>&nbsp;</span><div class="btn3">Share</div>
</a>

This is my code in Python, but it doesn't work. I use Selenium

......
elem = self.driver.find_elements_by_class_name("single_like_button btn3-wrap")[0].click(); 
......
هل كانت مفيدة؟

المحلول

find_elements_by_class_name() is apparently limited to a single class name.

You can use find_element_by_css_selector() instead and write:

self.driver.find_element_by_css_selector(
    ".single_like_button.btn3-wrap").click();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top