question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to check if an HTML tag has an attribute of 'disabled' or not?

See original GitHub issue

<material-button animated="true" class="btn btn-yes _ngcontent-EXCHANGE-57 _nghost-EXCHANGE-2" tabindex="0" role="button" aria-disabled="false" elevation="4"><div class="content _ngcontent-EXCHANGE-2">Save</div><material-ripple class="_ngcontent-EXCHANGE-2"><div class="__acx-ripple" style="top: -116px; left: -83px; transform: translate(-13px, 6px) scale(0.364962);"></div></material-ripple></material-button>

<material-button animated="true" class="btn btn-no _ngcontent-EXCHANGE-57 _nghost-EXCHANGE-2" tabindex="0" role="button" aria-disabled="false" elevation="4" disabled><div class="content _ngcontent-EXCHANGE-2">Save</div><material-ripple class="_ngcontent-EXCHANGE-2"><div class="__acx-ripple" style="top: -116px; left: -83px; transform: translate(-13px, 6px) scale(0.364962);"></div></material-ripple></material-button>

I want to click on .btn-no or .btn-yes class when the disabled attribute gets removed. How to do that?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kblokcommented, Sep 18, 2019

You can use waitForSelector:

const yes = await page.waitForSelector(".btn-yes:not([disabled])");
await yes.click();
1reaction
szakharcommented, Nov 2, 2020

You can use waitForSelector:

const yes = await page.waitForSelector(".btn-yes:not([disabled])");
await yes.click();

Thanks man 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How is jquery used to check for the 'disabled' attribute on an ...
Try $('#anchorID').is('[disabled=disabled]'). Will return true if disabled="disabled" is an attribute for the element.
Read more >
Check if an Element is Disabled using JavaScript | bobbyhadz
Use the disabled property to check if an element is disabled, e.g. if (element.disabled) {} . The disabled property returns true when the...
Read more >
How to check if element is disabled or enabled - CodeProject
Solution 1. Accept Solution Reject Solution. Using JQuery (which your What I have Tried example suggests you're using), there's the ...
Read more >
HTML disabled Attribute - W3Schools
The disabled attribute is a boolean attribute. When present, it specifies that the element should be disabled. A disabled element is unusable. The...
Read more >
HTML attribute: disabled - HTML: HyperText Markup Language
The Boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found