尝试查找似乎实际上具有输入元素动态特性的输入元素。此输入位于td内,并在网页上显示成功或失败,并在文本“完成代码”旁边。我已经尝试了xpath和id来找到输入元素,但是我遇到了“无法定位元素”。一旦完成了上面的第一步,然后我想提取值字段中的内容,该值字段实际上是网页上旁边显示的文本完成代码。例如
完成代码成功
我的代码-
completion_code = driver.find_element(By.XPATH, '//*[@id="code"]')
print(completion_code.text)
html
<tr>
<td id="label.code" class="label" type="string" choice="0" height="23px" nowrap="true">
<label onclick="" for="code" dir="ltr" class=" control-label"><span id="status." mandatory="false" oclass="" aria-label="" class=" required-marker"></span>
<span class="label-text" data-html="false">Completion code</span>
</label>
</td>
<td style="background-color:PaleGreen;width:100%;;" nowrap="true">
<input autocomplete="off" autocorrect="off" readonly="readonly" name="code" id="code" value="Success" onkeyup="" onchange="onChange('code');" size="" style="border:0px;background:transparent" maxlength="" type="text">
</td>
</tr>
答案 0 :(得分:0)
好吧,事实证明我认为等待不是它的一个因素,然后添加了以下内容,并从输入框中获得了显示所需结果的值
solver : str, {‘newton-cg’, ‘lbfgs’, ‘liblinear’, ‘sag’, ‘saga’}, default: ‘liblinear’.
Algorithm to use in the optimization problem.
For small datasets, ‘liblinear’ is a good choice, whereas ‘sag’ and ‘saga’ are faster for large ones.
For multiclass problems, only ‘newton-cg’, ‘sag’, ‘saga’ and ‘lbfgs’ handle multinomial loss; ‘liblinear’ is limited to one-versus-rest schemes.
‘newton-cg’, ‘lbfgs’ and ‘sag’ only handle L2 penalty, whereas ‘liblinear’ and ‘saga’ handle L1 penalty.