Unable to click the linktext using selenium execute_script function using selenium python
<p>Unable to click the linktext using <strong>selenium</strong> <code>execute_script</code> function</p>

<p>This is what I am tring to do:</p>

<pre><code>self.driver.execute_script("document.getElementByLinktext('Level 1s').click;")
</code></pre>

<p>You are <em>not calling</em> the <code>click()</code> method:</p>

<pre><code>self.driver.execute_script("document.getElementByLinktext('Level 1s').click();")
                                                                   FIX HERE^
</code></pre>

<p>Note that you can also locate the element with selenium and then pass it into the script:</p>

<pre><code>link = self.driver.find_element_by_link_text('Level 1s')
self.driver.execute_script("arguments[0].click();", link)
</code></pre>

<p>You can also perform the click via selenium directly if applicable:</p>

<pre><code>link.click()
</code></pre>

<p>Also related:</p>

<ul>
<li><a href="http://stackoverflow.com/questions/34562061/webdriver-click-vs-javascript-click">WebDriver click() vs JavaScript click()</a></li>
</ul>

python selenium