我将直接进入追逐和问题:
首先,这是我的代码(非常简单):
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select, WebDriverWait
el = driver.find_element_by_id("id1")
el.clear()
el.send_keys("2147000001")
el = driver.find_element_by_id("id2")
el.click()
el = driver.find_element_by_id("id3")
el.click()
textbox = driver.find_element_by_id("id4")
asd = textbox.get_attribute("innerHTML")
print asd
我面临的问题是它什么也没打印。我已经用 firebug 检查了 id4 元素,它是这样的:
<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>
如果我尝试使用 outerHTML,它会打印除 XML 之外的所有内容。这是为什么?我怎样才能得到我需要的信息?它是通过 javascript 生成的。