… in order to make a div which acts like a button.
This isn’t generally recommended as it requires a lot of work in order to ensure that the behaviour is consistent with how real buttons work across a variety of clients (including those which make use of screen readers or braille displays).
Solution 2 :
It is not necessary to use button for clicking and submitting forms. You can attach event listeners to any node in the DOM using JS and design div like a button. That’s why div is behaving like a button because they have registered onclick event on a div instead of putting a button there.
I recently tried to use selenium for learning. When I inspected the Twitter button, I find a div instead of a button.