Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iframe中拖动滑块?_Iframe_Browser_Draggable_Drag_Puppeteer - Fatal编程技术网

如何在iframe中拖动滑块?

如何在iframe中拖动滑块?,iframe,browser,draggable,drag,puppeteer,Iframe,Browser,Draggable,Drag,Puppeteer,我有一个html页面,在iframe中包含一个滑块 例如: 我想从左向右拖动滑块 我正在使用以下代码: const boundingBoxOfSlider = await (await iframe.$('element-to-drag')).boundingBox() const boundingBoxOfIframe = await (await page.$('.form-content')).boundingBox() await page.mouse.move(

我有一个html页面,在iframe中包含一个滑块

例如:


我想从左向右拖动滑块

我正在使用以下代码:

const boundingBoxOfSlider = await (await iframe.$('element-to-drag')).boundingBox()

const boundingBoxOfIframe = await (await page.$('.form-content')).boundingBox()


  await page.mouse.move(
    (boundingBoxOfSlider.x + boundingBoxOfIframe.x) + boundingBoxOfIframeOfSlider.width / 2,
    (boundingBoxOfSlider.y + boundingBoxOfIframe.y) + boundingBoxOfIframeOfSlider.height / 2
  )
  await page.mouse.down()

  // move the element to drag to the right (x+300)
  await page.mouse.move(
    (boundingBoxOfSlider.x + boundingBoxOfIframe.x) + boundingBoxOfIframeOfSlider.width / 2 + 300,
    (boundingBoxOfSlider.y + boundingBoxOfIframe.y) + boundingBoxOfSlider.height / 2
  )
  await page.mouse.up()

但它似乎不起作用


有什么建议吗?

iframe
元素句柄还是
框架
?它是框架。为什么?此部分的代码缺失,可能很重要。