yaniswang / jwebdriver Goto Github PK
View Code? Open in Web Editor NEWA webdriver client for Node.js
Home Page: http://jwebdriver.com/
License: MIT License
A webdriver client for Node.js
Home Page: http://jwebdriver.com/
License: MIT License
jWebDriver是否支持获取toast信息?
hi,
according to the api document, there is no "moveToElement" method, will this be add in the future, are there any workaround for now?
用UIrecorder录制下来的脚本,因为网站登录是需要验证码的,所以回放肯定是不成功的,就想通过cookie的方式看能不能登录,尝试用driver.cookie('test', '123')方法,发现是不行的。
var JWebDriver = require('jwebdriver');
var driver = new JWebDriver();
driver.session("firefox")
.url('https://www.baidu.com/')
.find('#kw')
.val('mp3')
.submit()
.title()
.then(function(title){
console.log(title);
})
.close();
运行报错
(node:88768) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Unrecognized channel: ANY
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'XXXX-PC', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111'
Driver info: driver.version: FirefoxDriver
(node:88768) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I want to run the test in normal chrome mode. please have an option to remove the incognito mode.
New version of jWebDriver supports retrieval of certain log types. However I don't know how to enable Performance Logs (http://chromedriver.chromium.org/logging/performance-log).
Is there a way to enable them and further retrieve them with browser.logs('performance'); or a workaround to get it?
我想在chrome浏览器启动时加载一个第三方插件,selenium里面直接通过options.addExtensions(new File("/path/to/extension.crx"));就可以设置了,但jWebDriver这里要怎么设置呢?
想让一个网站用不同用户登录,用多个tab会共享一个cookie不行,能否操作2个窗口?
driver.url("https://login.test.com")
// 失败
driver.cookie("ticket", "something", {
domain: 'test.com'
})
// 成功
driver.cookie("ticket", "something", {
domain: 'login.test.com'
})
非常感谢您开源的jWebDriver,非常适合做web项目测试。
我按照首页步骤操作后,现在chrome和edge可以使用,但是ie和firefox执行node.js示例脚本时出现错误。
脚本如下
var JWebDriver = require('jwebdriver');
var driver = new JWebDriver();
driver.session("ie")
.url('https://www.baidu.com/')
.find('#kw')
.val('mp3')
.submit()
.title()
.then(function(title){
console.log(title);
});
错误日志如下
IE浏览器
(node:13236) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error setting arguments for script
For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: 'PC016', ip: '192.168.2.78', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
(node:13236) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Firefox浏览器
(node:2992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Web element reference not seen before: undefined
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: 'PC016', ip: '192.168.2.78', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
(node:2992) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我的环境
Windows 10 64bit
IE 11.125.162969.0
Firefox 57.02 64bit
[email protected]
[email protected]
[email protected]
selenium-server-standalone-3.7.1.jar
2.33-x64-chromedriver
3.7.0-x64-IEDriverServer.exe
0.19.1-x64-geckodriver
16299-MicrosoftEdgeDriver.exe
ie浏览器按照selenium的要求做了权限配置。
我已验证这个环境下,单独使用selenium server能够正常操作各浏览器,我想可以排除selenium server和selenium webdriver的问题。
调查后,我想问题缩小到在jwebdriver这个范围内。
所以想咨询一下,为什么会出现这个问题,jWebDriver对环境(selenium、浏览器等)有什么要求吗?
期待您的回复
原来的using = /^.?//.test(value)?'xpath':'css selector';
没有考虑到(开头的情况
执行driver.sendElementKeys('中文+Test+12345678')之后后一位会覆盖前一位的字符
driver.sendKeys(_(Xfmhjy@2015{ESCAPE}
))执行的结果是无法输入大写“X”,而“@”自动被过滤掉了
@yaniswang ,请求帮助
我想利用jWebDriver实现以下需求
我有两个问题
jwebdriver是否支持macaca新增的touch的各种操作?
系统环境:
docker version
Client: Docker Engine - Community
Version: 20.10.1
docker-compose.yml 内容:
# To start Docker in Swarm mode, you need to run `docker swarm init`
# To deploy the Grid, `docker stack deploy -c docker-compose.yml grid`
# Stop with `docker stack rm grid`
version: '3.7'
services:
hub:
image: selenium/hub:3.141.59
environment:
TZ: Asia/Shanghai
JAVA_OPTS: -Xmx8192m
POOL_MAX: 30000
GRID_NEW_SESSION_WAIT_TIMEOUT: -1
GRID_JETTY_MAX_THREADS: -1
GRID_NODE_POLLING: 5000
GRID_CLEAN_UP_CYCLE: 5000
GRID_TIMEOUT: 120
GRID_BROWSER_TIMEOUT: 120
GRID_MAX_SESSION: 18000
GRID_UNREGISTER_IF_STILL_DOWN_AFTER: 120
GRID_DEBUG: "true"
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome:3.141.59
volumes:
- /dev/shm:/dev/shm
environment:
HUB_HOST: hub
HUB_PORT: 4444
deploy:
replicas: 10
entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh'
报错:
commons/start_mode/start_mode_Inte : chrome
1) "before all" hook
2) "after all" hook
0 passing (724ms)
2 failing
1) commons/start_mode/start_mode_Inte : chrome
"before all" hook:
Error: the object {
"capabilities": {
"acceptInsecureCerts": false
"browserName": "chrome"
"browserVersion": "88.0.4324.96"
"chrome": {
"chromedriverVersion": "88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/b
"userDataDir": "/tmp/.com.google.Chrome.baFK1C"
}
"goog:chromeOptions": {
"debuggerAddress": "localhost:41536"
}
"networkConnectionEnabled": false
"pageLoadStrategy": "normal"
"platformName": "linux"
"proxy": {}
"setWindowRect": true
"strictFileInteractability": false
"timeouts": {
"implicit": 0
"pageLoad": 300000
"script": 30000
}
"unhandledPromptBehavior": "dismiss and notify"
"webauthn:extension:largeBlob": true
"webauthn:virtualAuthenticators": true
"webdriver.remote.sessionid": "490f0dca7efedf7a4e8d7f537d5980b1"
}
"sessionId": "490f0dca7efedf7a4e8d7f537d5980b1"
} was thrown, throw an Error :)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
Running the current jWebdriver against Selenium 3+ and GeckoDriver, elements are not correctly identified.
Older implementation expected by jWebDriver when a call to retrieve an element. The body response to the wire protocol will use: "value":[{"ELEMENT":"1"}]
Newer implementation used by GeckoDriver and presumably by future webdriver implementation, the body response contains the element value as: "value":[{"element-6066-11e4-a52e-4f735466cecf":"4ba8d8d3-5f4d-4007-99e9-30fac0d76f3b"}]
You can see the hard-coded attribute element-6066-11e4-a52e-4f735466cecf
that should be referenced in the W3C docs for element
To support both standards, I am submitting a pull request with the updated correction.
Could it test the drag event?
http://jwebdriver.com/
点击进入官网之后随意的跳转第三方网站,骗人的吗?
查看了API,通过driver.info(),能获取到包含浏览器名称的信息,但是我要怎么从里面取出来browserName这个值?
#hub
selenium-standalone start -- -role hub
#node
selenium-standalone start -- -role node -hub http://localhost:4444/grid/register
selenium-standalone start
运行webdrivermocha test.spec.js
mocha test.spec.js
1) d2.spec : ie 11 "before all" hook:
Error: the string "Error forwarding the new session cannot find : Capabilities [{ie.ensureCleanSession=true, browserName=internet explorer, version=11, platform=ANY}]" was thrown, throw an Error :)
at process._tickCallback (internal/process/next_tick.js:103:7)
2) d2.spec : ie 11 "after all" hook:
Error: the string "Error forwarding the new session cannot find : Capabilities [{ie.ensureCleanSession=true, browserName=internet explorer, version=11, platform=ANY}]" was thrown, throw an Error :)
#-*- coding=utf-8 -*-
from selenium import webdriver
import os
iedriver = r"C:\Users\gujiangfei\Desktop\uirecorder\selenium_grid_2\.selenium\iedriver\2.53.1-x64-IEDriverServer.exe"
os.environ["webdriver.ie.driver"] = iedriver
driver = webdriver.Ie(iedriver)
driver.get("http://www.baidu.com")
#-*- coding=utf-8 -*-
from selenium import webdriver
import os
c = webdriver.DesiredCapabilities.INTERNETEXPLORER
driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=c)
driver.get("http://www.baidu.com")
通过以上对比测试,可以排除selenium-standalone.jar和iedriver.exe的版本问题,请大神看下是否是jwebdriver的问题导致使用selenium grid时候导致无法启动IE,万分感谢!
xtend can easily be replaced with Object.assign
// immutable
Object.assign({}, a, b)
// mutable
Object.assign(a, b)
Please add support for internet explorer 11. I am trying to use selenium standalone with jWebdriver. I it is crashing more frequently and at waitbody/click command are not working.
selenium grid v3,上传图片正常
我想30秒后等不到,加一个refresh的动作,用try + catch好像不生效,有什么办法么?
it('waitBody: ', async function(){ await driver.sleep(500).wait('body', 30000).html().then(function(code){ isPageError(code).should.be.false; }); });
After analysis, I found local machine don't install GraphicsMagick or ImageMagick ; it's well with GraphicsMagick or ImageMagick installed;
refernce document:
https://www.npmjs.com/package/gm
aheckmann/gm#359
\
Because this error is ignored here, this problem is difficult to find...
// in browser.js
png64 = yield new Promise((resolve) => gmShot.toBuffer('PNG', (error, buffer) => resolve(buffer)));
//==>
png64 = await new Promise((resolve,reject) => gmShot.toBuffer('PNG', (error, buffer) => error?reject(error): resolve(buffer)}));
i have a question is that a element id is random . How can I location
Css selector :
#node_jkagp1pm-jnpei0mr-node_jkagp1pr > div > div.kuma-uxform-field.kuma-uxform-field.kuma-select-uxform-field.vc-select-field.node_jkagp1pm-jnpei0mr-node_jkagp1pt.kuma-uxform-field__layout-h > div > ul > li > div > div > div > div.kuma-select2-selection__placeholder
Xpath://*[@id="node_jkagp1pm-jnpei0mr-node_jkagp1pr"]/div/div[1]/div/ul/li/div/div/div/div[1]
“node_jkagp1pm-jnpei0mr-node_jkagp1pr” is random generated 。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.