I am using Python/Selenium to click on an icon on a web site to add it as one of my condition. It’s making a Javascript call. I’ve tried find_element_by_css_selector and execute_script but was unable to access this element. Can anyone think of a way to click on this using a selenium call? Many thanks in advance!!!!

The element is:

<a href="javascript:void(0)" code="sc_u_sfwsj" class="mnuItmInc" ondblclick="mnuItm_dblClick();return false;" ="mnuItm_click(this,'{12:6,0:0,11:&quot;SFWSJ&quot;,2:&quot;SFWSJ&quot;,3:&quot;The Wall Street Journal - All sources&quot;,4:0,5:0,6:0,7:0,14:0,10:1}');return false;" title="Click to add to search; double-click to exclude from search.">The Wall Street Journal - All sources</a>

I have tried:

wd.find_element_by_css_selector("a[onlick*=The Wall Street Journal - All sources]").click()

wd.execute_script("mnuItm_click(this,'{12:6,0:0,11:&quot;SFWSJ&quot;,2:&quot;SFWSJ&quot;,3:&quot;The Wall Street Journal - All sources&quot;,4:0,5:0,6:0,7:0,14:0,10:1}');return false;").click()

Source link https://sqa.stackexchange.com/questions/35396/how-to--onclick-using-selenium-python


Please enter your comment!
Please enter your name here