1

I think this is weird, as I have been researching and most of the questions related to WebDriver execution time are about it running slow. However, the problem is that the page which I'm testing is not able to match and refresh at WebDriver execution speed. There are many inputs that need to be filled and I can see that the value is sent to the page (just so quickly), the page tries to refresh and process the input, but as there are just so many lines being executed at the same time the page is not able to keep it up (not that it crashes, just that the data is not filled correctly or not filled at all).

I don't think that implicit waits can be used, as the elements are displayed, clickable, and exist at the same time. Thus, WDIO immediately executes everything.

Has someone ever experienced something like this?

4
  • 1
    Can you share your test code and target DOM, besides additional logs, images and videos that may help on the diagnosis? Sep 18, 2020 at 5:45
  • Are you using Promises to sync with UI? Sep 20, 2020 at 19:45
  • wdio apparently has both a sync and an async mode. What front end library is being tested and which mode is being used? Oct 23, 2020 at 1:53
  • Are using sync or async ?
    – PDHide
    Feb 15, 2021 at 18:41

1 Answer 1

2

WebdriverIO is Javascript based automation framework that follows an asynchronous execution approach and consequently, webdriver's execution speed doesn't match. We as an automation testing services providers follow the below mentioned approaches according to the scenario to handle this behavior of Node.js based frameworks.

First: We can use "callbacks or promises" to handle asynchronous behavior, however, promises are more preferable over Callbacks to handle code with more efficacy.

Here is the implementation of code for reference :

test.it('Test page', function(){
testPage.isHomePageLogoDisplayed(function(testLogo){
assert.isTrue(testLogo, ['User is unable to login to application on providing valid username and password']);
}))

isHomePageLogoDisplayed = function(cb){
this.driver.wait(this.until.elementLocated({ locatorName: locatorValue }),timeoutWait).then(function(){
cb(true) ;
},function(err){
cb(false) ;
});
};

Second: Another popular practice used in software testing services company is using "async and await" which pauses the execution of the function and waits for the completion of previous passed instructions. code reference :

test.it('Test page', async function(){
await homePage.isHomePageLogoDisplayed(function(testLogo){
assert.isTrue(testLogo, ['User is unable to login to application on providing valid username and password']);
}))

isHomePageLogoDisplayed = async function(cb){
try {
await this.driver.wait(this.until.elementLocated({ locatorName: locatorValue }),timeoutWait);
cb(true);
} catch(error) {
console.log(error);
}};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.