casperjs + selenium 怎么定位iframe元素?

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

https://img2.mukewang.com/5c8759250001b56008000229.jpg

哈士奇WWW
浏览 623回答 2
2回答

MYYA

from selenium import webdriverdriver = webdriver.Firefox()driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript