我開始學習一對小時的硒夫婦。我有這樣的div標籤selenium:通過python選擇一個div標籤和文本
<div id="first">
<iframe src="/emulator/" scrolling="no" frameborder="0"></iframe>
</div>
<div id="second">
//some more html tags
</div>
如何選擇上面的div標籤並通過硒py代碼發送一些文本? (試圖谷歌搜索超過一小時 - 仍然沒有找到方法) 這是python代碼片段,它導致所需的div標籤頁。
class Wm2(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(30)
self.base_url = "http://localhost/"
self.verificationErrors = []
self.accept_next_alert = True
def test_wm2(self):
driver = self.driver
driver.get(self.base_url + "/")
driver.find_element_by_link_text("Log In").click()
driver.find_element_by_id("username").clear()
driver.find_element_by_id("username").send_keys("NAME")
driver.find_element_by_id("password").clear()
driver.find_element_by_id("password").send_keys("PWD123")
driver.find_element_by_name("submit").click()
#how to choose div tag and send_some text ?
謝謝,它的工作。 – 2013-02-21 07:09:27