How do I access an iframe from CasperJS?

后端 未结 5 1763
情书的邮戳
情书的邮戳 2020-11-29 04:33

I have a webpage with an iframe. I\'d like to access the contents of the iframe using CasperJS. In particular, I need to click buttons and fill a form. How can I do that?

5条回答
  •  -上瘾入骨i
    2020-11-29 05:22

    From 1.0 you can use withFrame

      casper.open("http://www.example.com/page.html", function() {
        casper.withFrame('flashHolder', function() {
          this.test.assertSelectorExists('#the-flash-thing', 'Should show Flash');
        });
      });
    

提交回复
热议问题