Skip to content

Commit

Permalink
Fix: Not clicking on verify link
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard127 committed Jul 20, 2023
1 parent e38a8d8 commit f7cc5ac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ func main() {
fmt.Println(link)

browser.MustPage(link)
page.WaitLoad()

fmt.Println("Verifying email...")
page.MustElement("#register-form > div.c-clearfix.c-submit-group > button").MustClick()
page.MustElement("#verify-email > button").MustClick()
fmt.Println("Email verified")

browser.MustClose()
Expand Down
15 changes: 15 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package main

import (
"fmt"
"github.com/go-rod/rod"
"os"
"strings"
"testing"
)
Expand All @@ -13,3 +15,16 @@ func TestParseLink(t *testing.T) {
link := body[index : index+end]
fmt.Println(link)
}

func TestVerifyClick(t *testing.T) {
url := `https://www.reddit.com/verification/jogInQyX2Z2YWFsbTZvMCIsICJzaWciOiAiQVFBQTZFSzlaRFlIdTVOcDB3WHRTZFV6WTluZUF4TU9zSjRaWXB3cmJoSTYySzg1WXVrSyJ9?correlation_id=1999df97-fcff-456c-937e-80fcc7af9989&ref=verify_e`

browser := rod.New().MustConnect()
page := browser.MustPage(url)
page.WaitLoad()

bytes, _ := page.Screenshot(true, nil)
os.WriteFile(fmt.Sprintf("screenshot%d.png", index), bytes, 0644)

fmt.Println(page.Has("#verify-email > button"))
}

0 comments on commit f7cc5ac

Please sign in to comment.