click
和 keydown
事件监听器来拯救你。
const btn = document.querySelector('.yWSHVqDY3QXtLSenwRoA')
btn.addEventListener('click', () => location.href = 'https://google.com')
btn.addEventListener('keydown', (e) => {
if (e.key == 'Enter') {
location.href = 'https://google.com'
}
})
<button class="yWSHVqDY3QXtLSenwRoA" data-test="create-account-create-button" type="submit"><span>Create account</span></button>