我想在c#中使用硒web驱动程序上传文件。 (“C:\ Users \ test \ Desktop \ test.cs”);如果你想要使用它,你可以使用下面的代码:在c#中使用硒web驱动程序上传文件#
但这不起作用。
这在硒的webdriver正确硒IDE,但不工作。
以下是网页的HTML代码:
,我想使用下列元素:如果您使用的是Firefox浏览器,而不是Send keys
使用type
<input class="js-attach-file" type="file" tabindex="-1" name="upload">
<!DOCTYPE html>
<html lang="en">
<head>
<body class="page-index firefox firefox-9 windows extra-large-window full-content window-up">
<div id="nocss">
<div id="surface" class="clearfix" style="height: 725px;">
<div class="window-overlay">
<div class="window" style="left: 375px; top: 50px; display: block;">
<div class="window-wrapper clearfix">
<div>
<div class="window-header-utils">
<div class="window-header clearfix">
<div class="window-main-col">
<div class="window-sidebar">
<div class="window-module card-label-list clearfix hide">
<div class="window-module clearfix">
<div class="window-module clearfix attachments">
<h3>Attachments</h3>
<ul class="attachment-list hide"></ul>
<p class="no-attachments empty">No attachments.</p>
<div class="uploader touch-hide">
<form class="realfile" enctype="multipart/form-data" method="post" action="/api/card/4f701c9daf1765861a15545c">
<input type="hidden" value="" name="token">
<input type="hidden" value="attachFile" name="method">
<input type="hidden" value="http" name="format">
<input class="js-attach-file" type="file" tabindex="-1" name="upload">
</form>
<a class="button-link highlight-icon fakefile js-fakefile">
</div>
<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; ">File too large. 10mb limit.</p>
</div>
<div class="window-module other-actions clearfix">
<div class="window-module quiet-actions clearfix">
</div>
</div>
</div>
</div>
</div>
<div class="pop-over clearfix fancy-scrollbar" style="display: none;">
<script>
<script src="https://d2k1ftgv7pobq7.cloudfront.net/js/78dcaf5810779a263fe6939fc4895487/all.js">
</body>
</html>
解决这个问题,你是否尝试“看”硒进程,并检查什么真的发生了? – ChrFin 2012-03-26 07:38:51
是的,我尝试过......但实际上没有东西.......我无法理解硒在做什么........在源代码中获取硒...... ...上传按钮可用...让我知道你是否想要更多的信息.........谢谢。 – Ramesh 2012-03-26 09:18:31
硒究竟做了什么或不做什么?它是否进入路径?它是否开始上传?它是否会在硒rc中发生任何错误? – ChrFin 2012-03-26 09:36:55