Skip to main content

Unable to Click Buttonclick button with Selenium Webdriver/C#selenium webdriver using C#

I am having trouble with clicking a button within a modal using Selenium and C#. 

The button is for a photo upload, and for some reason the element that is select-able (tested with JS in the console) is set to display:nonedisplay:none and hidden behind a button. Because it is set to display:nonedisplay:none, Selenium WebDriver appears to not be able to "see" it. 

Right now it is not feasible to change the markup, but I would really like to be able to complete this test. I was hoping someone had a workaround that they could share? Here is the markup:

<div id="uploadPhoto">
<div id="uploadifive-file_upload" class="uploadifive-button btn" style="height: 30px; line-height: 30px; overflow: hidden; position: relative; text-align: center; width: 100px;">
<i class="icon-plus"></i>Upload Photo<input id="file_upload" name="file_upload" style="display: none;" type="file">
<input style="font-size: 30px; opacity: 0; position: absolute; right: -3px; top: -3px; z-index: 999;" accept="image/*" type="file"></div>
<div id="uploadifive-file_upload-queue" class="uploadifive-queue"></div>
</div>

Unable to Click Button with Selenium Webdriver/C#

I am having trouble clicking a button within a modal using Selenium and C#. The button is for a photo upload, and for some reason the element that is select-able (tested with JS in the console) is set to display:none and hidden behind a button. Because it is set to display:none, Selenium WebDriver appears to not be able to "see" it. Right now it is not feasible to change the markup, but I would really like to be able to complete this test. I was hoping someone had a workaround that they could share? Here is the markup:

<div id="uploadPhoto">
<div id="uploadifive-file_upload" class="uploadifive-button btn" style="height: 30px; line-height: 30px; overflow: hidden; position: relative; text-align: center; width: 100px;">
<i class="icon-plus"></i>Upload Photo<input id="file_upload" name="file_upload" style="display: none;" type="file">
<input style="font-size: 30px; opacity: 0; position: absolute; right: -3px; top: -3px; z-index: 999;" accept="image/*" type="file"></div>
<div id="uploadifive-file_upload-queue" class="uploadifive-queue"></div>
</div>

Unable to click button with selenium webdriver using C#

I am having trouble with clicking a button within a modal using Selenium and C#. 

The button is for a photo upload, and for some reason the element that is select-able (tested with JS in the console) is set to display:none and hidden behind a button. Because it is set to display:none, Selenium WebDriver appears to not be able to "see" it. 

Right now it is not feasible to change the markup, but I would really like to be able to complete this test. I was hoping someone had a workaround that they could share? Here is the markup:

<div id="uploadPhoto">
<div id="uploadifive-file_upload" class="uploadifive-button btn" style="height: 30px; line-height: 30px; overflow: hidden; position: relative; text-align: center; width: 100px;">
<i class="icon-plus"></i>Upload Photo<input id="file_upload" name="file_upload" style="display: none;" type="file">
<input style="font-size: 30px; opacity: 0; position: absolute; right: -3px; top: -3px; z-index: 999;" accept="image/*" type="file"></div>
<div id="uploadifive-file_upload-queue" class="uploadifive-queue"></div>
</div>
Source Link
Haney
  • 95
  • 1
  • 3
  • 15

Unable to Click Button with Selenium Webdriver/C#

I am having trouble clicking a button within a modal using Selenium and C#. The button is for a photo upload, and for some reason the element that is select-able (tested with JS in the console) is set to display:none and hidden behind a button. Because it is set to display:none, Selenium WebDriver appears to not be able to "see" it. Right now it is not feasible to change the markup, but I would really like to be able to complete this test. I was hoping someone had a workaround that they could share? Here is the markup:

<div id="uploadPhoto">
<div id="uploadifive-file_upload" class="uploadifive-button btn" style="height: 30px; line-height: 30px; overflow: hidden; position: relative; text-align: center; width: 100px;">
<i class="icon-plus"></i>Upload Photo<input id="file_upload" name="file_upload" style="display: none;" type="file">
<input style="font-size: 30px; opacity: 0; position: absolute; right: -3px; top: -3px; z-index: 999;" accept="image/*" type="file"></div>
<div id="uploadifive-file_upload-queue" class="uploadifive-queue"></div>
</div>