我有以下来自nodejs pack easyimage 的片段,并且我也安装了ImageMagick。 当我运行下面的代码时,它只是通过但无法裁剪图像。
easyimage.crop(
{
src: "F:/screenshot.png", // Contains fullscreen image
dst: "F:/screenshot.png", // New image with cropped name
x: 400,
y: 500,
cropwidth: 50,
cropheight: 20,
gravity: "North-West",
},
(err, stdout, stderr) => {
if (err) throw err
}
)
Run Code Online (Sandbox Code Playgroud) 尝试为Jenkins安装插件时,看到以下错误。
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\tech>cd C:\Program Files (x86)\Jenkins
C:\Program Files (x86)\Jenkins>java -jar jenkins-cli.jar -s http://localhost:8081/ install-plugin ant.hpi -deploy -restart
Exception in thread "main" java.io.IOException: No X-Jenkins-CLI2-Port among [null, X-Required-Permission, X-Jenkins,
X-You-Are-In-Group, X-Hudson, Content-Length, Expires, X-You-Are-Authenticated-As, X-Permission-Implied-By, Set-Cookie,
Server, X-Content-Type-Options, Date, X-Jenkins-Session, Content-Type]
at hudson.cli.CLI.getCliTcpPort(CLI.java:290)
at hudson.cli.CLI.<init>(CLI.java:133)
at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
at hudson.cli.CLI._main(CLI.java:474)
at hudson.cli.CLI.main(CLI.java:389)
Suppressed: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8081/cli
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:78)
at hudson.cli.CLI.connectViaHttp(CLI.java:163)
at hudson.cli.CLI.<init>(CLI.java:137) …Run Code Online (Sandbox Code Playgroud) 要求:默认情况下,在主窗口搜索 webelement,如果找到则执行操作,否则在 iframes 中搜索 webelement 并执行所需的操作
硒 3.141
'''
WebElement el = driver.findElement(By.xpath("//*[contains(text(),'here')]"));
boolean displayFlag = el.isDisplayed();
if(displayFlag == true)
{
sysout("element available in main window")
el.click();
}
else
{
for(int f=0;f<10;f++)
{
sysout("element available in frameset")
switchToFrame(frameName[f]);
el.click();
System.out.println("Webelement not displayed");
}
}
'''
Run Code Online (Sandbox Code Playgroud)
我的脚本在第一行本身就失败了。它试图在主窗口中查找元素,但元素实际上在 iframe 中可用。
但要求是先在主窗口中搜索,然后才导航到 iframe。如何处理这样的用例?
有什么建议会有所帮助吗?谢谢你。
ant ×1
cmd ×1
easyimage ×1
imagemagick ×1
java ×1
javascript ×1
jenkins ×1
node.js ×1
selenium ×1