I'm using react-testing-libarary to test my react application. For some reason, I need to be able to find the element by id
and not data-testid
. There is no way to achieve this in the documentation.
Is there a way to achieve this?
I have the rendered output as follows:
const dom = render(<App />);
I'm looking for something along the lines of:
const input = dom.getElementById('firstinput');
//or
const input = dom.getById('firstinput');
document.getElementById('firstinput')
– Forbidden