我在puppeteer中遇到问题,在记录框架本身时,我得到了这个信息:
<template>
<div>
<v-carousel height="300" v-bind:hide-delimiters="true" interval="60000000" id="categorieCarousel" >
<v-carousel-item v-for="n in nombreDeCarouselItem" v-bind:key="n">
<v-layout justify-center >
<v-flex v-for="x in nombreDAlbum" v-bind:key="x">
<albumPreview v-bind:album="categorieAlbums[count()]" class="CategorieAlbumPreview" />
</v-flex>
<v-spacer>
</v-spacer>
</v-layout>
</v-carousel-item>
</v-carousel>
</div>
</template>
<script>
import albumPreview from './AlbumPreview.vue'
export default {
props:["Albums"],
components:{
albumPreview
},
data(){
return{
nombreDAlbum:0,
nombreDeCarouselItem:0,
compteurAlbum:-1,
categorieAlbums:
[
{
id:1,
nom:"dsadasdasdas1",
link:"https://lasueur.com/wp-content/uploads/2019/04/Koba-LaD-L-Affranchi.jpg"
},
{
id:2,
nom:"dsadasdasdas2",
link:"https://lasueur.com/wp-content/uploads/2019/04/Koba-LaD-L-Affranchi.jpg"
},
{
id:3,
nom:"dsadasdasdas3",
link:"https://lasueur.com/wp-content/uploads/2019/04/Koba-LaD-L-Affranchi.jpg"
},
{
id:4,
nom:"dsadasdasdas4",
link:"https://lasueur.com/wp-content/uploads/2019/04/Koba-LaD-L-Affranchi.jpg"
},
{
id:5,
nom:"dsadasdasdas5",
link:"https://lasueur.com/wp-content/uploads/2019/04/Koba-LaD-L-Affranchi.jpg"
},
{
id:6,
nom:"dsadasdasdas6",
link:"https://lasueur.com/wp-content/uploads/2019/04/Koba-LaD-L-Affranchi.jpg"
}
]
}
}
,
mounted(){
this.nombreDAlbum=3;//represente le nombre d'albums dans un slide du carousel
this.nombreDeCarouselItem= Math.ceil(this.Albums.length/this.nombreDAlbum);//represente le nombre de carousel items,
//math.ceil pour sassurer davoir 1 carousel de plus que this.Albums.length/this.nombreDAlbum
alert("nombreDAlbum "+this.nombreDAlbum+" nombredeCarouselItem "+this.nombreDeCarouselItem);
},
methods:{
count:function(){
this.compteurAlbum=this.compteurAlbum+1;
return 0;
//afin de display tout les albums
},
yio:function( hey){
alert(hey);
}
},
computed:{
increment:function(){
//permet de savoir a quelalbum on est rendu afin de le passe au album preview,
//afin de display tout les albums
this.count();
return this.compteurAlbum;
}
}
}
</script>
<style>
</style>
但是登录Set {
Frame {
_frameManager: [FrameManager],
_client: [CDPSession],
_parentFrame: [Circular],
_detached: false,
_lifecycleEvents: [Set],
_mainWorld: [DOMWorld],
_secondaryWorld: [DOMWorld],
_childFrames: Set {},
_name: 'frame_name',
_name: undefined,
时,我得到一个空字符串。另外,我认为我的计时逻辑有些问题,因为我觉得这样做比等待5秒钟要少一些硬编码。谢谢。
frame.name()
答案 0 :(得分:0)
name
或id
。GitHub中的帮助程序功能。
function waitForFrame(page, frameName) {
let fulfill;
const promise = new Promise(x => fulfill = x);
checkFrame();
return promise;
function checkFrame() {
const frame = page.frames().find(f => f.name() === frameName);
if (frame)
fulfill(frame);
else
page.once('frameattached', checkFrame);
}
}
// 1. waiting for frame with name 'someFrame' to get attached
const frame = await waitForFrame(page, 'someFrame');
// 2. waiting for the frame to contain the necessary selector
await frame.waitForSelector('#selector');
const button = await frame.$('#selector');
button.click();