sebv/node-wd-sync

Whether wd-sync supports slow instance..?

Closed this issue · 24 comments

Hi,

My instance is very slow, I am using wd-sync for testing but I am facing a lot of time delay issues. When I repeat my test again without any change in code, it provides new type of error.

Errors like..

Error response status: 7
Error response status: 11
Error response status: 28
Element didn't become visible

How can I solve these type of issues, could you help me out?

sebv commented

There is not enough information to help, but the error list is there.

Looks like you are trying to apply method to element which are not there.

I'm getting that element sometimes but sometimes i don't (My instance is too slow. it takes approx. 20 seconds for each page), is there any possibility of getting error while running mulitiple js together using mocha.

sebv commented

You can set the timeout in mocha. If it is not sufficient, the issue is most probably within your page.

The problem is when we launch the staging url from our machine, the dev instance from our side going fine with same timeout or even lesser time out settings

sebv commented

Sorry it is not really possible to answer this kind of issue, you need to isolate your problem, and if it is reproducible submit some code sample so people can look at it.

Thank you so much for your immediate replies.
One thing, How to get element value for dynamic menu items.?

sebv commented

It doesn't matter for wd wether the items are dynamic, but maybe you need to use one of the wait methods to make sure that the element you want to get is available.

Ok, how can I find the menu using menu name and click the particular menu without getting css elements (all menu item have same class).

Sample menu

Menu 1

Menu 2 ---->> I want to click this menu (Position may change)

Menu 2

sebv commented

loop on elements.

Its working fine ;-) thanks. But I test using saucelab.com its not fine. It take too much time to test and some test case was failed during some time-out issues. any solution for that..?

sebv commented

Actually the tests on SauceLabs are probably more realistic, but yes the init and get are more expensive, so adjust the timeout for that. Also you can disable video capture. If you have more issue with Saucelabs, it is best to post on the wd project rather than wd-sync. The wd project was started by Saucelabs staff.

When I am running my test suite in sauce-lab, after 30 minutes this error comes (Test exceeded maximum duration after 1800 seconds) after that all my test case were failing. Could you please tell me how or where to increase sauce-lab time limit in my code.

sebv commented

Not sure if it is possible. As I said, better ask Saucelabs questions in the wd package. But my guess, is you need to split up your test suite and/or investigate where it takes time.

var username = ''
, accessKey = '';

var wdSync;
try {
wdSync = require('wd-sync');
} catch (err) {
wdSync = require('../../index');
}

// 2/ wd saucelabs example

desired = {
platform: "LINUX",
name: "wd-sync demo",
browserName: "firefox"
};

var client = wdSync.remote(
"ondemand.saucelabs.com",
80,
username,
accessKey)
, browser = client.browser
, sync = client.sync;

sync( function() {

console.log("server status:", browser.status());
browser.init(desired);
console.log("session capabilities:", browser.sessionCapabilities());

browser.get("http://google.com");
console.log(browser.title());

var queryField = browser.elementByName('q');
browser.type(queryField, "Hello World");
browser.type(queryField, "\n");

browser.setWaitTimeout(3000);
browser.elementByCss('#ires'); // waiting for new page to load
console.log(browser.title());

browser.quit();
});


How to use sauce lab Additional Configuration in this example ..?

like.. "record-video": false , "max-duration": 300

same in wd-sync ..?

sebv commented

You can try this: Monkey patch 'wd', then require 'wd-sync'. (Example below, with another method.)

var wd = require('wd');

// monkey patching
wd.webdriver.prototype.elementByCssSelectorWhenReady = function(selector, timeout, cb) {
  var _this = this;
  this.waitForElementByCssSelector(selector, timeout, function() {
    _this.elementByCssSelector(selector, cb);
  });
};

var wdSync = module.exports =require('wd-sync');

Hi, Thanks.
I am using like this, to stop video recording and screen-shots.

var desired = {
        name : core.config.automationTest.browser.name,
        browserName: core.config.automationTest.browser.browserName,
        "record-screenshots": false,
        "record-video": false,
        "max-duration": 10800,
        "screen-resolution": "1280x1024"
}

it("should open login page", wrap(function () {
    browser.init(desired);
    browser.maximize('current');
    browser.get(loginUrl);
    browser.title().should.equal('Test page');
 }));

How can I upload files and document in sauce labs? which is working in my local. If there is any file path to upload in sauce labs.

sebv commented

uploadFile(filepath) -> filepath

Sauce labs provide any file path to upload..?

Can you please give one simple sample program to upload file in sauce labs using [WD-SYNC]
I was try different ways but its not working.