Note that there are some explanatory texts on larger screens.

plurals
  1. POUpload a file using selenium web driver in c#
    text
    copied!<p>I am trying to upload a file using selenium web driver in c#.</p> <p>I am trying this: WebDriver.FindElement(By.Name("upload")).SendKeys("C:\Users\test\Desktop\test.cs");</p> <p>but this is not working.</p> <p>This is working properly in selenium IDE but not in selenium webdriver.</p> <p>Following is the HTML code of the page:</p> <p>where I am trying to use following element: <code>&lt;input class="js-attach-file" type="file" tabindex="-1" name="upload"&gt;</code></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;body class="page-index firefox firefox-9 windows extra-large-window full-content window-up"&gt; &lt;div id="nocss"&gt; &lt;div id="surface" class="clearfix" style="height: 725px;"&gt; &lt;div class="window-overlay"&gt; &lt;div class="window" style="left: 375px; top: 50px; display: block;"&gt; &lt;div class="window-wrapper clearfix"&gt; &lt;div&gt; &lt;div class="window-header-utils"&gt; &lt;div class="window-header clearfix"&gt; &lt;div class="window-main-col"&gt; &lt;div class="window-sidebar"&gt; &lt;div class="window-module card-label-list clearfix hide"&gt; &lt;div class="window-module clearfix"&gt; &lt;div class="window-module clearfix attachments"&gt; &lt;h3&gt;Attachments&lt;/h3&gt; &lt;ul class="attachment-list hide"&gt;&lt;/ul&gt; &lt;p class="no-attachments empty"&gt;No attachments.&lt;/p&gt; &lt;div class="uploader touch-hide"&gt; &lt;form class="realfile" enctype="multipart/form-data" method="post" action="/api/card/4f701c9daf1765861a15545c"&gt; &lt;input type="hidden" value="" name="token"&gt; &lt;input type="hidden" value="attachFile" name="method"&gt; &lt;input type="hidden" value="http" name="format"&gt; &lt;input class="js-attach-file" type="file" tabindex="-1" name="upload"&gt; &lt;/form&gt; &lt;a class="button-link highlight-icon fakefile js-fakefile"&gt; &lt;/div&gt; &lt;p class="error js-file-too-large" style="display:none; -moz-border-radius: 3px; -webkit-border-radius: 3px; font-weight: bold; margin: 8px 0 0; padding: 6px; background: #e3e3e3; "&gt;File too large. 10mb limit.&lt;/p&gt; &lt;/div&gt; &lt;div class="window-module other-actions clearfix"&gt; &lt;div class="window-module quiet-actions clearfix"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="pop-over clearfix fancy-scrollbar" style="display: none;"&gt; &lt;script&gt; &lt;script src="https://d2k1ftgv7pobq7.cloudfront.net/js/78dcaf5810779a263fe6939fc4895487/all.js"&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload