I'm using wdio 7 last couple of weeks. but still unable to resolve intercepted element.
In protractor, I'm using
browser.actions().
click($(".pay-modal-container i[class='webfont-date_range']")).
sendKeys(protractor.Key.TAB).
sendKeys(protractor.Key.TAB).
sendKeys(protractor.Key.ENTER).
perform();
Don't know In Wdio how it works. Please help me if anyone has an idea of it.
Note : Already used browser.execute("arguments[0].click()", locator); not doing anything if i used into script
The ElementClickInterceptedException occurs when a pop-up gets in the way of a regular Selenium/WebDriver click, (eg: How do I close pop-up windows with Selenium in Python when I don't know when they will pop up?)
When that happens, you have two options:
First click to close the pop-up that's in the way.
Use a Javascript click instead of a regular click.
Given that WDIO is already a Javascript framework, you should have no troubles running a Javascript command to perform that click. Or you may decide to click to close the pop-up first.
browser.performActions([{
"type": "pointer",
"id": "click on add button",
parameters: { pointerType: 'mouse' },
actions: [
{ type: 'pointerMove', x: 1, y: 1, origin: browser.findElement("css selector", locator) },
{ type: 'pointerDown', button: 0 },
{ type: 'pointerUp', button: 0 },
]
}
]);
Related
I have a simple page in Laravel 8 with livewire (jetstream). On that page i can open a modal form. In fact i have 2 modal forms in that page, one for editing and one for confirming prior to a delete.
I was testing and had Edge open with one instance (logged in a test user) and one instance in Chrome (logged in as another user).
When i opened the edit-modal on Chrome, the confirm-delete modal opened in my Edge browser.
I display my ConfirmDelete model with this:
<x-jet-dialog-modal wire:model="confirmDelete">
...
i watched my variable and it did go from false to true when i opende the other modal on my other browser.
{{-- modal form --}}
<x-jet-dialog-modal wire:model="modalFormVisible">
When i look at my Network tab in the Chrome diagnostics is see this:
{
"data": {
"modalFormVisible": true
},
"checksum": "7697e888b4472a9519f206d733a5d15e42a3f346b0d7fbcd349a25f67de67c86"
}
And at that same time, doing nothing in my edge browser, there i see this in my network tab:
{
"htmlHash": "f65525e2",
"data": {
"confirmDelete": true,
"modelId": null,
"name": null,
"myPermissions": null
},
"checksum": "60117ff32a9956f915e1a2dab4a6671ce2ff236435ae10c4955f94cb7f9d590d"
}
I am using Apache and am using browsersync.
Any Ideas? Is this normal behaviour?
I am trying to add custom action "Copy" in Ng2SmartTable Grid.
I am facing issue with click event handler of custom action. There are 3 buttons in grid Edit,Delete,Copy. Edit ,Delete is working fine. But 'Copy' method is not getting fired onclick of copy button.
Grid.component.html code
<ng2-smart-table [settings]="settings" (custom)="onCustom($event)" [source]="source" (edit)="onEdit($event)" (delete)="onDelete($event)"></ng2-smart-table>
OnEdit ,OnDelete working fine But OnCustom not working.
Grid.component.ts file code for settings for ng2smarttable.
mode: 'external',
actions: {
add: false,
custom: [{
name: 'copy', title: 'Copy'
}]
},
onCustom method not working at all.
There must be an issue with the function in your component, the code you have shared in your question is setup correctly and works in this stackblitz.
Please note: when the copy button is clicked the event is passed to the onCustom function in the app.component.ts and logs the event in the console.
https://stackblitz.com/edit/smarttable-e8gqql?embed=1&file=app/app.component.ts
I am injecting bunch of javascript code to a website by means of selenium webdriver (over chromedriver).
While the method i use works most of the time, it fails when an iframe is loaded or page is reloaded by website's javascript code.
I can trace the problem from the chromedriver's log.
For example:
[6.203][DEBUG]: DEVTOOLS EVENT Runtime.executionContextDestroyed {
"executionContextId": 1
}
[6.203][DEBUG]: DEVTOOLS EVENT Runtime.executionContextsCleared {
}
[6.203][DEBUG]: DEVTOOLS EVENT Runtime.executionContextCreated {
"context": {
"auxData": {
"frameId": "274.1",
"isDefault": true
},
"id": 5,
"name": "",
"origin": "https://<some url>"
}
}
When i see executionContextDestroyed i know that, most probably my injected scripts are destroyed too. I have tried bunch of options like switch_to.default_content() or switch_to.parent_frame but they didn't help, as there is nothing to do in case of reload but re-inject the scripts.
My question is, is there a way to hook into executionContextCreated events, so i can inject my scripts/functions into the context again and again.
I'm trying to make a test for a login webpage where there is the possibility of using Thirdparties social login. When you click on facebook icon, for example, a new popup appears asking for user/password. I'm using waitForPopup and withPopup as specified by the documentation to handle that, but is not working. Is never finding the element (via xpath) inside the xpath, so I can never log in using facebook in our test.
This is an example code that check if the facebook button is there, click on it and wait for the popup:
casper.then(function() {
test.comment("When we click facebook button");
casper.waitForSelector(x(facebookButton), function() {
test.assertExists(x(facebookButton), "Facebook icon is showing");
casper.click(x(facebookButton));
}, function timeout() { // step to execute if check has failed
casper.test.fail("Timeout loading login page");
});
});
casper.then(function() {
casper.waitForPopup(/facebook\.com\/login/, function() {
test.comment("And we fill facebook login info");
casper.withPopup(/facebook\.com\/login/, function() {
this.viewport(1600, 900);
casper.sendKeys(x(facebookEmail), facebookLogin[0]);
casper.sendKeys(x(facebookPassword), facebookLogin[1]);
casper.click(x(facebookLogin));
});
}, function timeout() { // step to execute if check has failed
casper.test.fail("Timeout loading faceebook login");
});
});
The output of the test is:
# When we click facebook button
PASS Facebook icon is showing
# And we fill facebook login info
FAIL Cannot get informations from xpath selector: //input[#id='email']: element not found.
# type: uncaughtError
# file: casper/import-login-testing.js:1058
# error: Cannot get informations from xpath selector: //input[#id='email']: element not found.
# CasperError: Cannot get informations from xpath selector: //input[#id='email']: element not found.
# at getElementInfo (/Users/ginogalotti/testing-presentation/node_modules/casperjs/modules/casper.js:1058)
# at /Users/ginogalotti/testing-presentation/node_modules/casperjs/modules/casper.js:1589
# at casper/import-login-testing.js:84
# at runStep (/Users/ginogalotti/testing-presentation/node_modules/casperjs/modules/casper.js:1553)
# at checkStep (/Users/ginogalotti/testing-presentation/node_modules/casperjs/modules/casper.js:399)
# stack: not provided
For me, that means that is finding the popup, the waitForPopup is triggering and is just not using the popup to look for the facebookEmail element. I'm still learning about casperjs, so probably this is not even the best way to approach the problem; but I would really thank some guidance.
Thanks in advance,
Example website that I'm testing: https://import.io/login
Am new to protractor. I found some errors while automating the URL using protractor. And I can access the URL manually and does not find any issues. Please find the code mentioned below and kindly clarify my concern.
Screenshot of cmd while executing the code
exports.config={
specs: ['try.js'],
//seleniumArgs: ['-browserTimeout=60']
capabilities:{
'browserName':'chrome',
},
baseUrl:'',
allScriptsTimeout:3000,
//getPageTimeout:5000,
framework:'jasmine2',
jasmineNodeOpts: {
defaultTimeoutInterval:56000,
isVerbose: true,
}
}
spec: try.js
===========
describe('first try',function(){
var EW=protractor.ExpectedConditions;
beforeEach(function(done){
ignoreSynchronization=true;
browser.get('');
});
it('open PO',function(){
//clicking login button
var login=element(by.linkText('Login'));
browser.wait(EW.presenceOf(login),10000);
login.click();
//clicking open Po dashboard icon/link
var po=element(by.linkText('Open PO'));
browser.wait(EW.presenceOf(po),20000);
po.click();
//entering value 100 in the fiter field
var e=element.all(by.repeater('colFilter in col.filters')).get(00).element(by.tagName('input'));
browser.wait(EW.presenceOf(e),10000);
e.sendKeys(100);
//selecting the filterd values and printing it in console
element.all(by.repeater('col in colContainer.renderedColumns track by col.uid').column('Entity')).getText().then(console.log);
});
});
Make sure you have ng-app defined on all of your pages. Protractor requires it to run. If the page has redirects or just takes some time before it loads, try something like this:
browser.get(websiteUrl);
browser.wait(function () {
return browser.executeScript('return !!window.angular');
}, 10000, 'Error: Angular was not found on the page within ten seconds');
This will wait up to ten seconds for angular to load up, and fail if it is not there.