onclick does not exist on type element code example
Example: simulate click typescript
let element: HTMLElement = document.getElementsByClassName('btn')[0] as HTMLElement;
element.click();
let element: HTMLElement = document.getElementsByClassName('btn')[0] as HTMLElement;
element.click();