image of Error in ipfs await click here
Image of code for ipfs click here
What should i try now because ipfs.files.add is also not working
Related
Here is the code im trying to use, its working but its getting an error when the puppeteer is trying to find and click the Audiot Button, i dont know what to put next for it to click on audio button on recaptcha
const frame = await page.frames().find(f => f.name().startsWith("a-"));
await frame.waitForSelector('div.recaptcha-checkbox-border');
await page.waitFor(3000)
await frame.click('div.recaptcha-checkbox-border');
I'm working in an application that requires these types of login where a new window (no tab) pops up and ask you to login, in the same way that twitter or facebook do (or used to do), where it shows where to put your email and password, click "login" and then the window would close and the main window would receive the authentication and keep going.
I can do it in "headed" mode, when I click the authentication button, the window pops up and I get a grip of it with
const newWindow = (await browser.pages())[1]
and then I'd navigate like normal where in my case I only have to click a single button because I'm already logged in the page I'm trying to use for authentication
await newWindow.waitFor("//SomeXpath")
const buttonToClick= (await newWindow.$x("//SomeXpath"))[0]
await buttonToClick.click()
Again, in headed mode it works fine. but in headless mode is like this 2nd page would not open.
If I try:
console.log(await browser.pages())
I only see the main page where I open puppeteer
I've seen people talking about the "target" class, but it seems is for new tabs, and the examples I've found didn't work for me (or probably I wasn't able to understand and properly use them)
I'm afraid that what I'm trying to do is not possible and I'm chasing a ghost.
Thanks
Edited:
A snapshot of the window with the button I have to click
Snapshot of the new window
Also I've tried this, but it didn't work either:
const newPagePromise = new Promise(x => browser.once('targetcreated', target => x(target.page())));
const popup = await newPagePromise;
where popUp would be the new "page". But if I do a console.log(popup) it returns "null"
I am new to protractor and would like to test if a link is working.
I understand trying to get the element id but what should i expect that the link equals?
Also has anyone got any good documentation on example protractor tests?
I have been through this http://angular.github.io/protractor/#/tutorial which was helpful but i need more example of possible tests I could do.
i have this so far:
it('should redirect to the correct page', function(){
element(by.id('signmein').click();
expect(browser.driver.getCurrentUrl()).toEqual("http://localhost:8080/web/tfgm_customer/my-account");
});
would like to test if a link is working
This is a bit broad - it could mean the link to have an appropriate hrefattribute, or that after clicking a link there should be a new page opened.
To check the href attribute, use getAttribute():
expect(element(by.id('myLink')).getAttribute('href')).toEqual('http://myUrl.com');
To click the link use click(), to check the current URL, use getCurrentUrl():
element(by.id('myLink').click();
expect(browser.getCurrentUrl()).toEqual("http://myUrl.com");
Note that if there is a non-angular page opened after the click, you need to play around with ignoreSynchronization flag, see:
Non-angular page opened after a click
If the link is opened in a new tab, you need to switch to that window, check the URL and then switch back to the main window:
element(by.id('myLink')).click().then(function () {
browser.getAllWindowHandles().then(function (handles) {
browser.switchTo().window(handles[handles.length - 1]).then(function () {
expect(browser.getCurrentUrl()).toEqual("http://myUrl.com");
});
// switch back to the main window
browser.switchTo().window(handles[0]);
});
});
I am trying to create a Chrome extension that when entering a certain site. I am deleting the download history. I am using this from the background page:
chrome.downloads.erase({},
function(item)
{
console.log("Erased item");
console.log(item);
});
The problem is that it is not working when I am sending a message from the contact script after entering the url I wanted.
I use send Message in the content script
chrome.runtime.sendMessage
and receive the message in the background page
chrome.runtime.onMessage.addListener
This is the output I get although there are some files in the download history:
Erased item
Array[0]
If I run the erase() from within the background page console it works fine
it seems that it happens because there is no user interaction.
If I put a clear button and click on it the deletion does works
But if I use timeout it does not
Any Idea why it happens?
I have seen that it has something to do with the setTimeout
This works in the background page:
setTimeout(function(){
console.log('erasing downloads');
chrome.downloads.erase({});
}
, 0);
But this does not:
setTimeout(function(){
console.log('erasing downloads');
chrome.downloads.erase({});
}
, 1000);
I think I had finally found the reason for the problem.
After downloading I have closed Chrome with taskkill /f, like this:
taskKill /im "chrome.exe" /f
After reopening Chrome I got in this line in the download page:
thefilenamedownloaded.exe The browser crashed before the download completed.
If I used taskKill /im "chrome.exe" (without /f) than the problem did not happen.
The bug may be actually more complicated than this because that when I had user interaction its also worked. But for now it solved my problem. Hopes this help anyone else
Have a small doubt in how message passing works in chrome using content scrips. I modified the default example (http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/messaging/timer/) for message passing given in the chromium documentation to the one that looks below :
popup.html
function testRequest() {
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.sendRequest(tab.id, {counter: "getHTML"}, function handler(response) {
alert("Inside Client = "+response.counter2);
});
});
}
and my content script looks like this :
page.js
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
alert(request.counter);
alert("Inside server .. Req Counter = "+request.counter);
sendResponse({counter2: "5"});
});
When I execute the testRequest from popup.html, the content script is getting called as expected. I do get both the alerts i have
declared with their respective values. But my popup.html response code doesnt seem to be called .. The alert I have inside the popup.html - alert("Inside Client = "+response.counter2); is not being executed.
On the other hand, If i have a debug point inside the client, its working ! Kinda strange.. Can somebody tell me how and why this is happening ?
Thank you in advance..
your code is correct. I am mistaken what I said before.
Believe me when I say it, I was puzzled why it didn't work. It turned out to be that I am running the browser action on the chrome://extensions/ page. In Chrome Extensions, the API will not let you execute or send any requests to that page. Do it on a normal page like Google.com and you will see your popup.
You cannot show an alert dialog within popup page.
That is why you don't see: alert("Inside Client = "+response.counter2); }
If you want to see it working, you can add a console logger and view it within the Web Inspector. Replace the alert with: console.log(response.counter2);
As far as I can tell, alerts from a popup will only appear if the popup is open.
You see the alert when you're debugging the popup because the debugger keeps the popup open.
I'm pretty sure there are also no problems with creating alerts from the background page.