I'm developing a Chrome Extension that automates click. My extension worked on Multi-Page Application. It can click the buttons on the website. But I'm having a problem with this specific website which is a Single Page Application.
My extension can't trigger button click using this JavaScript
function clickButton(){
var submit = document.getElementsByClassName(".class");
submit.click();
}
My Question is, how to trigger button click on a single page application? Because it seems like using .click() isn't working
Further information
The way my extension works is that I click on a search button, it shows me result. If there is a result, I do specific things. But if result is empty, I go back to previous page (search page) and then hit the search button again. And my extension can't click the search button nor back button. My assumption is, when I click the button using .click(), the web doesn't request that specific HTML page to show. Am I wrong?
Another Info About This Site
So this web is a single page application. After I login to this site, it brings me to https://sample.com/page1 -which is a home. Then I go to the search page (the URL is still the same but it shows a different layout, which is search page). On the search page, I input the search parameters, then hit the search button (the URL is still the same but it shows the different layout, which is search results). So I guess the way these web works is every time I click on a certain page, it requests page layout using history.pushState -i guess. So I'm wondering if there's a way to manipulate this history.pushState? For example, instead of clicking the back button, can I just go straight to the desired page?