Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 以水平形式输入文本_Python 3.x_Selenium - Fatal编程技术网

Python 3.x 以水平形式输入文本

Python 3.x 以水平形式输入文本,python-3.x,selenium,Python 3.x,Selenium,我有一个带有上传按钮的水平表单,如下面的源代码。我试图使用selenium将下面的“newRes”文件路径输入到水平框中。我已经尝试了下面所有的代码行。我已经注释掉了每一次失败的尝试。它们都会抛出与找不到元素相关的错误。我是selenium的新手,请有人告诉我下面应该查找的源代码的哪一部分,以及如何在当前显示“oldFile.docx”的框中输入“newRes”文件路径的任何提示,我将不胜感激 代码: 源代码: <div class="form-group has-feedback" da

我有一个带有上传按钮的水平表单,如下面的源代码。我试图使用selenium将下面的“newRes”文件路径输入到水平框中。我已经尝试了下面所有的代码行。我已经注释掉了每一次失败的尝试。它们都会抛出与找不到元素相关的错误。我是selenium的新手,请有人告诉我下面应该查找的源代码的哪一部分,以及如何在当前显示“oldFile.docx”的框中输入“newRes”文件路径的任何提示,我将不胜感激

代码:

源代码:

<div class="form-group has-feedback" data-ng-switch="isOnEditMode" data-ng-class="{'has-success': (profile.resume.fileName &amp;&amp; frmInputResume.resumeFile.$error.diceFileFormat==false &amp;&amp; frmInputResume.resumeFile.$error.diceMaxFileUploadSize==false), 'has-error': (!profile.resume.fileName || frmInputResume.resumeFile.$error.diceFileFormat == true || frmInputResume.resumeFile.$error.diceMaxFileUploadSize == true)}">
            <!-- ngSwitchWhen: true --><div data-ng-switch-when="true" class="ng-scope">
                <label class="col-md-3 profile-summary-label">Résumé:</label>
                <div class="col-md-6 col-lg-7 col-xs-12">
                    <div id="resumeUpload" class="file-input-btn btn-block">
                        <input type="file" name="resumeFile" id="resumeFileInput" data-dice-file-input-reader="" data-file-model="resume" data-ng-model="resumeInput" data-supported-file-extension-pattern="diceRegex.supportedFileExtensions" data-max-file-upload-size="2048000" data-file-read-callback="uploadResume(resume)" class="ng-pristine ng-valid">
                        <span class="btn btn-default btn-lg btn-file-name ng-binding" data-ng-class="{'text-muted': !profile.resume.fileName}">old_file.docx</span>
                        <span class="btn btn-default btn-lg btn-file-choose">Upload</span>
                    </div>
                    <span class="glyphicon form-control-feedback" style="line-height:46px; height:46px; width:46px;" data-ng-class="{'icon-filled-check-4': (profile.resume.fileName &amp;&amp; frmInputResume.resumeFile.$error.diceFileFormat == false &amp;&amp; frmInputResume.resumeFile.$error.diceMaxFileUploadSize==false), 'icon-filled-delete-2': (!profile.resume.fileName || frmInputResume.resumeFile.$error.diceFileFormat==true || frmInputResume.resumeFile.$error.diceMaxFileUploadSize == true)}"></span>
                    <span class="error ng-hide" ng-show="frmInputResume.resumeFile.$error.diceFileFormat" style="color: #C00;">We support .doc, .docx, .pdf, .txt, .rtf, up to 2MB.</span

简历:
old_file.docx
上传

我们支持.doc、.docx、.pdf、.txt、.rtf,最大容量为2MB。请尝试下面的代码。这将上载您想要的文件

file_upload = driver.find_element_by_id("resumeFileInput")
file_upload.send_keys(/path/to/file) # Like "C:\user\desktop\test1.txt"
请让我知道这是否适合你

file_upload = driver.find_element_by_id("resumeFileInput")
file_upload.send_keys(/path/to/file) # Like "C:\user\desktop\test1.txt"