2015-09-29 36 views
1

在此編輯器中,當您輸入內容時,所有內容都轉到標記<p>,但系統無法識別/html/body/p,因此我使用/html/body或切換到活動元素,他們兩個都不工作。無法發送內容到富文本編輯器的iframe中的/ html/body/p

  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 = '<br>'") 
      webElement = driver.find_element_by_xpath("/html/body") 
      webElement.send_keys(developreqTestData["inputOne"][inputNotes]) 
      time.sleep(1) 
      driver.switch_to_default_content() 
      time.sleep(0.5) 
+0

我用PhantomJS 1.9.2 –

回答

0

driver.execute_script( 「document.body.innerHTML = '你的內容'」)

這個作品