I am trying to automate hitting a javscript button using a python script and web driver however no matter how I try to refer to the element it doesn't seem to activate the javscript. Here's an excerpt from the website I am trying to hit the button on:
<li>
<a href="javascript:;" data-blogid="19079" id="picture-trigger">
<i class="glyphicon glyphicon-picture light-red"></i >
<span> Picture </span >
</a >
</li >
I've tried selecting by CSS selector, by XPATH and while I see the element being selected (doted line around it when running), nothing happens.
I've also tried both .click() and .submit() neither one seems to work. Here's my most recent attempt:
element = mydriver.find_element_by_id("picture-trigger")
element.click()
I think perhaps the issue is the javascript:; isn't being triggered when called from web driver the same way it is when an interactive user hits it but I'm at a loss for how else to automate clicking it.
Does anyone with more web driver experience know why this isn't working or how I can get this working?
Thanks Brad
Here's what I see when I run the code:
Here's what it looks like when I manually click on the button: