How click on element with id containing colons in puppeteer? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag?Puppeteer: Click on element with textUnable to choose by selectors using PuppeteerWeb Automation to go to the next page - Invoking method that returns Promise within await block) - await is only valid in asyncPuppeteer element click coordinates flakinessPuppeteer, looping through links selected by xpathNodeJS/Puppeteer - Help clicking elementComplicated CSS selector in PuppeteerWith Puppeteer, is there an option to scroll past element before click?How to check if an element contains a certain string in puppeteer?Puppeteer - how to click on an inner element
How to assign captions for two tables in LaTeX?
What's the purpose of writing one's academic bio in 3rd person?
Is the Standard Deduction better than Itemized when both are the same amount?
Marking the functions of a sentence: 'She may like it'
Does accepting a pardon have any bearing on trying that person for the same crime in a sovereign jurisdiction?
How does cp -a work
If 'B is more likely given A', then 'A is more likely given B'
Can a non-EU citizen traveling with me come with me through the EU passport line?
Is there a service that would inform me whenever a new direct route is scheduled from a given airport?
What is this single-engine low-wing propeller plane?
Check which numbers satisfy the condition [A*B*C = A! + B! + C!]
How can I make names more distinctive without making them longer?
If a contract sometimes uses the wrong name, is it still valid?
What happens to sewage if there is no river near by?
Does the Giant Rocktopus have a Swim Speed?
Does surprise arrest existing movement?
Is it true that "carbohydrates are of no use for the basal metabolic need"?
Disable hyphenation for an entire paragraph
What are 'alternative tunings' of a guitar and why would you use them? Doesn't it make it more difficult to play?
How widely used is the term Treppenwitz? Is it something that most Germans know?
When -s is used with third person singular. What's its use in this context?
Are variable time comparisons always a security risk in cryptography code?
What would be the ideal power source for a cybernetic eye?
Bonus calculation: Am I making a mountain out of a molehill?
How click on element with id containing colons in puppeteer?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?Puppeteer: Click on element with textUnable to choose by selectors using PuppeteerWeb Automation to go to the next page - Invoking method that returns Promise within await block) - await is only valid in asyncPuppeteer element click coordinates flakinessPuppeteer, looping through links selected by xpathNodeJS/Puppeteer - Help clicking elementComplicated CSS selector in PuppeteerWith Puppeteer, is there an option to scroll past element before click?How to check if an element contains a certain string in puppeteer?Puppeteer - how to click on an inner element
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Button has id like this my:very:beautiful:button
<input id="my:very:beautiful:button" type="image" src="https://xxx/search_off.gif" name="my:very:beautiful:button" onmouseout="imgOff('searchBttn', this)" onmouseover="imgOn('searchBttn', this)" class="btn searchBttn" onclick="doSubmit(this, 'clearBttn')">
In puppeteer my attempt to click on this button is:
await page.click('#my:very:beautiful:button');
Throws:
Error: Evaluation failed: DOMException: Failed to execute 'querySelector' on 'Document': '#my:very:beautiful:button' is not a valid selector.
With double escape characters:
await page.click('#my\:very\:beautiful\:button');
Throws:
Error: No node found for selector: #my:very:beautiful:button
I assume the problem is colon. Any thoughts how click on it?
add a comment |
Button has id like this my:very:beautiful:button
<input id="my:very:beautiful:button" type="image" src="https://xxx/search_off.gif" name="my:very:beautiful:button" onmouseout="imgOff('searchBttn', this)" onmouseover="imgOn('searchBttn', this)" class="btn searchBttn" onclick="doSubmit(this, 'clearBttn')">
In puppeteer my attempt to click on this button is:
await page.click('#my:very:beautiful:button');
Throws:
Error: Evaluation failed: DOMException: Failed to execute 'querySelector' on 'Document': '#my:very:beautiful:button' is not a valid selector.
With double escape characters:
await page.click('#my\:very\:beautiful\:button');
Throws:
Error: No node found for selector: #my:very:beautiful:button
I assume the problem is colon. Any thoughts how click on it?
I was able to make it work with the second optionawait page.click('#my\:very\:beautiful\:button');
– hardkoded
Mar 22 at 12:46
add a comment |
Button has id like this my:very:beautiful:button
<input id="my:very:beautiful:button" type="image" src="https://xxx/search_off.gif" name="my:very:beautiful:button" onmouseout="imgOff('searchBttn', this)" onmouseover="imgOn('searchBttn', this)" class="btn searchBttn" onclick="doSubmit(this, 'clearBttn')">
In puppeteer my attempt to click on this button is:
await page.click('#my:very:beautiful:button');
Throws:
Error: Evaluation failed: DOMException: Failed to execute 'querySelector' on 'Document': '#my:very:beautiful:button' is not a valid selector.
With double escape characters:
await page.click('#my\:very\:beautiful\:button');
Throws:
Error: No node found for selector: #my:very:beautiful:button
I assume the problem is colon. Any thoughts how click on it?
Button has id like this my:very:beautiful:button
<input id="my:very:beautiful:button" type="image" src="https://xxx/search_off.gif" name="my:very:beautiful:button" onmouseout="imgOff('searchBttn', this)" onmouseover="imgOn('searchBttn', this)" class="btn searchBttn" onclick="doSubmit(this, 'clearBttn')">
In puppeteer my attempt to click on this button is:
await page.click('#my:very:beautiful:button');
Throws:
Error: Evaluation failed: DOMException: Failed to execute 'querySelector' on 'Document': '#my:very:beautiful:button' is not a valid selector.
With double escape characters:
await page.click('#my\:very\:beautiful\:button');
Throws:
Error: No node found for selector: #my:very:beautiful:button
I assume the problem is colon. Any thoughts how click on it?
edited Mar 25 at 7:55
user52028778
asked Mar 22 at 8:13
user52028778user52028778
16.3k22331
16.3k22331
I was able to make it work with the second optionawait page.click('#my\:very\:beautiful\:button');
– hardkoded
Mar 22 at 12:46
add a comment |
I was able to make it work with the second optionawait page.click('#my\:very\:beautiful\:button');
– hardkoded
Mar 22 at 12:46
I was able to make it work with the second option
await page.click('#my\:very\:beautiful\:button');– hardkoded
Mar 22 at 12:46
I was able to make it work with the second option
await page.click('#my\:very\:beautiful\:button');– hardkoded
Mar 22 at 12:46
add a comment |
2 Answers
2
active
oldest
votes
The "double escaping" works. The colon should not be the problem.
The problem is most likely that the element simply has not been rendered yet. To wait for the element to be rendered first, you can use the function page.waitForSelector like this:
const selector = '#my\:very\:beautiful\:button';
await page.waitForSelector(selector);
await page.click(selector);
You are right, it was waiting for some recourse or rendering.waitForSelectordid not helped, but static sleep for 1 second did the trickawait page.waitFor(1000)
– user52028778
Mar 25 at 8:20
add a comment |
You can try an attribute selector:
await page.click('[id="my:very:beautiful:button"]');
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55295385%2fhow-click-on-element-with-id-containing-colons-in-puppeteer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The "double escaping" works. The colon should not be the problem.
The problem is most likely that the element simply has not been rendered yet. To wait for the element to be rendered first, you can use the function page.waitForSelector like this:
const selector = '#my\:very\:beautiful\:button';
await page.waitForSelector(selector);
await page.click(selector);
You are right, it was waiting for some recourse or rendering.waitForSelectordid not helped, but static sleep for 1 second did the trickawait page.waitFor(1000)
– user52028778
Mar 25 at 8:20
add a comment |
The "double escaping" works. The colon should not be the problem.
The problem is most likely that the element simply has not been rendered yet. To wait for the element to be rendered first, you can use the function page.waitForSelector like this:
const selector = '#my\:very\:beautiful\:button';
await page.waitForSelector(selector);
await page.click(selector);
You are right, it was waiting for some recourse or rendering.waitForSelectordid not helped, but static sleep for 1 second did the trickawait page.waitFor(1000)
– user52028778
Mar 25 at 8:20
add a comment |
The "double escaping" works. The colon should not be the problem.
The problem is most likely that the element simply has not been rendered yet. To wait for the element to be rendered first, you can use the function page.waitForSelector like this:
const selector = '#my\:very\:beautiful\:button';
await page.waitForSelector(selector);
await page.click(selector);
The "double escaping" works. The colon should not be the problem.
The problem is most likely that the element simply has not been rendered yet. To wait for the element to be rendered first, you can use the function page.waitForSelector like this:
const selector = '#my\:very\:beautiful\:button';
await page.waitForSelector(selector);
await page.click(selector);
answered Mar 22 at 16:13
Thomas DondorfThomas Dondorf
2,248623
2,248623
You are right, it was waiting for some recourse or rendering.waitForSelectordid not helped, but static sleep for 1 second did the trickawait page.waitFor(1000)
– user52028778
Mar 25 at 8:20
add a comment |
You are right, it was waiting for some recourse or rendering.waitForSelectordid not helped, but static sleep for 1 second did the trickawait page.waitFor(1000)
– user52028778
Mar 25 at 8:20
You are right, it was waiting for some recourse or rendering.
waitForSelector did not helped, but static sleep for 1 second did the trick await page.waitFor(1000)– user52028778
Mar 25 at 8:20
You are right, it was waiting for some recourse or rendering.
waitForSelector did not helped, but static sleep for 1 second did the trick await page.waitFor(1000)– user52028778
Mar 25 at 8:20
add a comment |
You can try an attribute selector:
await page.click('[id="my:very:beautiful:button"]');
add a comment |
You can try an attribute selector:
await page.click('[id="my:very:beautiful:button"]');
add a comment |
You can try an attribute selector:
await page.click('[id="my:very:beautiful:button"]');
You can try an attribute selector:
await page.click('[id="my:very:beautiful:button"]');
answered Mar 22 at 16:40
vsemozhetbytvsemozhetbyt
2,351711
2,351711
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55295385%2fhow-click-on-element-with-id-containing-colons-in-puppeteer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I was able to make it work with the second option
await page.click('#my\:very\:beautiful\:button');– hardkoded
Mar 22 at 12:46