east east - 4 years ago 182
Python Question

Python+Selenium Scrape Error: ElementNotVisibleException

I'm currently trying to use Selenium/Python/PhantomJS to scrape the results of the form below:


It looks like when I try to click on the search button, I get an ElementNotVisibleException error.

My code:


After some digging online, it seems like the button may be hidden. Indeed, here is the relevant HTML code from the search page:

<input type="button" value="Search!" class="btn btn-primary searchTrigger" style="width: 200px;" />
<input type="submit" name="ctl00$MainContent$btnSearch" value="Search" id="MainContent_btnSearch" style="width: 200px; display: none;" />
<div id="MainContent_ctl00" style="display:none;">

I tried preceding my previous code with a click of the searchTrigger, but this is still not working:


Any advice would be greatly appreciated!

Answer Source

Requested element has attribute style="display:none;", so you need to make it visible

Try to use following code:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download