小编Ale*_*kij的帖子

Puppeteer:单击带有文本的元素

是否有任何方法(在API中找不到)或解决方案点击带有文本的元素?

例如我有html:

<div class="elements">
    <button>Button text</button>
    <a href=#>Href text</a>
    <div>Div text</div>
</div>
Run Code Online (Sandbox Code Playgroud)

我想点击包含文字的元素(点击.elements里面的按钮),如:

Page.click('Button text', '.elements')
Run Code Online (Sandbox Code Playgroud)

有解决方案吗

puppeteer

55
推荐指数
7
解决办法
5万
查看次数

无法显示图像,因为它包含错误[图像生成器]

有图像生成器的一些问题.也许你会发现问题是什么?我得到:"图像无法显示,因为它包含错误",我正在下载图像文件,但没有错误.

<?php
if(isset($_GET['id']) && $_GET['id']){
//  require('../libs/global.inc.php');
    $id = $_GET['id'];
    $imagePath = "gov_220.jpg";//$track->getImg($id);
    $framePath = "otgFrame.png";
    $fontsize = 14;
    $font = 'times.ttf';
    $artistName = "bla bla";//$view->CutTheName("by ".$track->getArtist($id), 16);
    //$artistName = iconv(mb_detect_encoding($artistName, mb_detect_order(), true), "UTF-8", $artistName);
    $trackName = "la la";//$view->CutTheName($track->getName($id),16);
    $photo = imagecreatefromjpeg($imagePath);
    $w = imagesx($photo);
    $h = imagesy($photo);

    $new_image = imagecreatetruecolor(200, 200);
    imagecopyresampled($new_image, $photo, 0, 0, 0, 0, 200, 200, $w, $h);

    imagealphablending($new_image,true);

    $frame = imagecreatefrompng($framePath);    
    imagecopy($new_image,$frame,0,0,0,0,200,200);
    $fontcolor = imagecolorallocate($new_image, 255, 255, 255);
    imagettftext($new_image, $fontsize, 0,2,177,$fontcolor, $font, $trackName );
    $fontcolor …
Run Code Online (Sandbox Code Playgroud)

php gd image

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

gd ×1

image ×1

php ×1

puppeteer ×1