import web.view;
var wb = web.view(winform);
//初始化参数--remote-debugging-port=9222 --explicitly-allowed-ports=6001,6000,6666
//webView2 控件透明
wb.defaultBackgroundColor = 0x00000000;
//网站访问
wb.go("http://aardio.net")
wb.waitEle(selector)
wb.waitEle(selector,callback,timeout)
wb.waitEle(selector,js,timeout)
wb.waitEle("body","
//这里方便演示动态修改远程网页的 CSS 背景为透明色,直接改CSS可以更简单
this.style.backgroundColor='#00000000'
//异步执行以刷新透明背景后显示
setTimeout(()=>aardio.winform.show(),100);
this.onmouseup= function(e){
if(e.button == 2){
aardio.winform.close();
} }
");
//点击按钮
wb.waitEle("#su","this.click()");
//执行 JS 并获取返回值。
wb.doScript("window.location.href",function(result,err){
winform.msgbox(result,"doScript")
})
//js获取节点,在doScript中执行。
document.querySelectorAll('.main-select > ul >li')[1].children[0].click()
document.querySelector('#all').value = '作者1'
document.querySelector('#password-number').value = '密码123'
document.querySelector('[data-type=account]').click()
//用法一:异步等待参数@1指定CSS选择器的节点,回调 aardio 函数
/*
wb.waitEle("#kw",function(ok,err){
wb.doScript("document.querySelector('#kw').value='aardio'")
})
*/
//用法二:同步等待参数@1指定CSS选择器的节点
/*
wb.waitEle("#kw")
wb.doScript("document.querySelector('#kw').value='aardio'")
*/
//用法三:异步等待参数@1指定CSS选择器的节点,回调 Javascript 代码
wb.waitEle("#kw",`
//注意在JS代码中,this为找到的节点
this.value = "aardio";
`)
主题数 6 | 今日评论 0 | 今日主题 0 |