필자가 쓰는 python 스크립트에서 필드에 입력 된 이름을 추출해야한다 (셀렌을 사용). 여기에 html이 있습니다.python/selenium에서 다른 요소의 요소를 가져 오는 방법이 있습니까?
<div id="CF00NC000000576hm_ileinner"><a onmouseover="LookupHoverDetail.getHover('lookup005C0000003xG8C00NC000000576hm', '/005C0000003xG8C/m?retURL=%2F00QC000001DMZB8&isAjaxRequest=1&nocache=1370473054922').show();" onmouseout="LookupHoverDetail.getHover('lookup005C0000003xG8C00NC000000576hm').hide();" onfocus="LookupHoverDetail.getHover('lookup005C0000003xG8C00NC000000576hm', '/005C0000003xG8C/m?retURL=%2F00QC000001DMZB8&isAjaxRequest=1&nocache=1370473054922').show();" onblur="LookupHoverDetail.getHover('lookup005C0000003xG8C00NC000000576hm').hide();" id="lookup005C0000003xG8C00NC000000576hm" href="/005C0000003xG8C">James Brown</a></div>
는 XPath는 //*[@id="CF00NC000000576hm_ileinner"]
입니다. 이것에 대해 이동하는 방법에 대한
내 추측은 사용 :
elem1 = driver.find_element_by_xpath('//*[@id="CF00NC000000576hm_ileinner"]')
elem2 = elem1.get_attribute("innerHTML")
elem3 = elem2.get_attribute("innerHTML")
print elem3
나는이 경우 출력 "제임스 브라운 (James Brown)"의 스크립트를합니다.
나는 다음과 같은 오류가 발생합니다 :
AttributeError: 'unicode' object has no attribute 'get_attribute'