Skip to content

Commit

Permalink
Fix cookies acceptation xpath + add "www." to connection page redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
hbollon committed May 12, 2021
1 parent c09f910 commit 72d6603
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ func (bot *IGopher) ConnectToInstagram() {
func (bot *IGopher) connectToInstagramWebDriver() {
log.Info("Connecting to Instagram account...")
// Access Instagram url
if err := bot.SeleniumStruct.WebDriver.Get("https://instagram.com/?hl=en"); err != nil {
if err := bot.SeleniumStruct.WebDriver.Get("https://www.instagram.com/?hl=en"); err != nil {
bot.SeleniumStruct.Fatal("Can't access to Instagram. ", err)
}
randomSleep()
// Accept cookies if requested
if find, err := bot.SeleniumStruct.WaitForElement("//button[text()='Accept']", "xpath", 10); err == nil && find {
elem, _ := bot.SeleniumStruct.GetElement("//button[text()='Accept']", "xpath")
if find, err := bot.SeleniumStruct.WaitForElement("//button[text()='Accept All']", "xpath", 10); err == nil && find {
elem, _ := bot.SeleniumStruct.GetElement("//button[text()='Accept All']", "xpath")
elem.Click()
log.Debug("Cookies validation done!")
} else {
Expand Down

0 comments on commit 72d6603

Please sign in to comment.