用Python Selenium检索XML表单
我将直截了当地追问: 首先,下面是我的代码(非常简单): 我面临的问题是它什么也不打印。我用firebug检查了id4元素,如下所示:用Python Selenium检索XML表单,python,xml,selenium,selenium-webdriver,Python,Xml,Selenium,Selenium Webdriver,我将直截了当地追问: 首先,下面是我的代码(非常简单): 我面临的问题是它什么也不打印。我用firebug检查了id4元素,如下所示: <textarea spellcheck="false" class="debug hint" id="id4" style="display: inline;"> <?xml version="1.0"?> <?xml version="1.0"?> org.oneandone.ipa
<textarea spellcheck="false" class="debug hint" id="id4" style="display: inline;">
<?xml version="1.0"?>
<?xml version="1.0"?>
org.oneandone.ipayment.fraud.wrappers.SimilarIpaymentIdsResponse {
*ipaymentIds => org.oneandone.ipayment.fraud.IpaymentIds {
ipaymentId => [
0 => 80000000000
1 => 2147000165
2 => 2147000180
3 => 2147000130
4 => 2147000190
5 => 2147000192
6 => 2147000197
7 => 2147000144
8 => 2147000151
9 => 2147000198
10 => 2147000001
11 => 2147000170
12 => 2147000185
13 => 2147000179
14 => 2147000182
15 => 2147000183
16 => 2147000186
17 => 2147000193
18 => 2147000199
19 => 2147000201
20 => 2147000202
21 => 2147000204
22 => 2147000187
23 => 2147000218
24 => 2147000222
25 => 2147000301
26 => 2147000433
27 => 2147000434
28 => 2147000438
29 => 2147000461
30 => 2147000120
31 => 2147000462
32 => 2147002088
33 => 2147002672
34 => 2147003278
35 => 2147000229
36 => 2147000232
37 => 2147000326
]
__id => "0.97800600 1383227941"
}
errorcode => 0
additional => "Similar ipaymentIds of 2147000001 retrieved."
__id => "
0.97788900 1383227941"
}</textarea>
?xml version=“1.0”?
?xml version=“1.0”?
org.oneandone.ipayment.fraud.wrappers.similaripaymentids响应{
*ipaymentIds=org.oneandone.ipayment.fraud.ipaymentIds{
ipaymentId=[
0 = 80000000000
1 = 2147000165
2 = 2147000180
3 = 2147000130
4 = 2147000190
5 = 2147000192
6 = 2147000197
7 = 2147000144
8 = 2147000151
9 = 2147000198
10 = 2147000001
11 = 2147000170
12 = 2147000185
13 = 2147000179
14 = 2147000182
15 = 2147000183
16 = 2147000186
17 = 2147000193
18 = 2147000199
19 = 2147000201
20 = 2147000202
21 = 2147000204
22 = 2147000187
23 = 2147000218
24 = 2147000222
25 = 2147000301
26 = 2147000433
27 = 2147000434
28 = 2147000438
29 = 2147000461
30 = 2147000120
31 = 2147000462
32 = 2147002088
33 = 2147002672
34 = 2147003278
35 = 2147000229
36 = 2147000232
37 = 2147000326
]
__id=“0.97800600 1383227941”
}
错误代码=0
additional=“检索到214700001的类似iPaymentID。”
__id=”
0.97788900 1383227941"
}
如果我尝试使用outerHTML,它会打印除XML之外的所有内容。为什么呢?我怎样才能得到我需要的信息?它是通过javascript生成的。我自己设法找到了这个问题的答案(最后);在实际打印出值之前,脚本需要超时“time.sleep(1)”,因为该字段是使用jquery填充的。
如果没有超时,脚本实际上会在填充元素之前捕获元素的innerHTML。这就是为什么输出是空的。这行获取的是什么
asd=textbox.get_text()
?你能试着让我们知道吗?嗨。我无法使用textbox.get_text()(AttributeError:'WebElement'对象没有属性'get_text')。但是,我成功地使用了textbox.text->结果是一个空行。。。如果我使用asd=textbox.get_属性(“outerHTML”),我确实会打印一行,它是这样的:但它不包括我试图获取的XML
<textarea spellcheck="false" class="debug hint" id="id4" style="display: inline;">
<?xml version="1.0"?>
<?xml version="1.0"?>
org.oneandone.ipayment.fraud.wrappers.SimilarIpaymentIdsResponse {
*ipaymentIds => org.oneandone.ipayment.fraud.IpaymentIds {
ipaymentId => [
0 => 80000000000
1 => 2147000165
2 => 2147000180
3 => 2147000130
4 => 2147000190
5 => 2147000192
6 => 2147000197
7 => 2147000144
8 => 2147000151
9 => 2147000198
10 => 2147000001
11 => 2147000170
12 => 2147000185
13 => 2147000179
14 => 2147000182
15 => 2147000183
16 => 2147000186
17 => 2147000193
18 => 2147000199
19 => 2147000201
20 => 2147000202
21 => 2147000204
22 => 2147000187
23 => 2147000218
24 => 2147000222
25 => 2147000301
26 => 2147000433
27 => 2147000434
28 => 2147000438
29 => 2147000461
30 => 2147000120
31 => 2147000462
32 => 2147002088
33 => 2147002672
34 => 2147003278
35 => 2147000229
36 => 2147000232
37 => 2147000326
]
__id => "0.97800600 1383227941"
}
errorcode => 0
additional => "Similar ipaymentIds of 2147000001 retrieved."
__id => "
0.97788900 1383227941"
}</textarea>