casperjs + selenium 怎么定位iframe元素?casper.then(function SetHaulier(){ test.comment("Set Haulier"); driver = webdriver.PhantomJS(); driver.switch_to.frame(0); content = driver.page_source.encode('utf-8'); //driver.switch_to.frame(0); //require('utils').dump(this.getElementBounds('//html/body/form/div[1]/div[2]/iframe')); this.click(xPath("//tr/td[7]/a/span")); casper.wait(5000,function Sleep(){ casper.capture(config.captureDir+"/WMC Dashboard (Ligentia)/DCBook/09-ClickDCBookLink.png"); });});页面Html
2 回答
MYYA
TA贡献1868条经验 获得超4个赞
from selenium import webdriver
driver = webdriver.Firefox()
driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
添加回答
举报
0/150
提交
取消