1
在web測試中,我打算獲取iframe(/ htme/body/p)的內容,有可能嗎?是否有可能在iframe webdriver python中獲取iframe的內容?
我用這個方法來設置iframe的內容:
driver.switch_to_frame(driver.find_element_by_xpath("//iframe[contains(@title,'ALT')]"))
driver.switch_to_active_element()
time.sleep(1)
driver.execute_script(("document.body.innerHTML = '%s'" % recurWorkflowTestData["inputEditor"][inputNotes]))
time.sleep(1)
driver.switch_to_default_content()
它的工作原理。我需要學習一些Javascript。感謝@alecxe –