Skip to content

Commit

Permalink
chore: apply v0.4.1 changes to internals packages
Browse files Browse the repository at this point in the history
  • Loading branch information
hbollon committed Mar 21, 2022
1 parent d58e706 commit a50f4b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/actions/dm.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func sendMessageWebDriver(bot *types.IGopher, user, message string) (bool, error

// Type and select user to dm
if find, err := bot.SeleniumStruct.WaitForElement(
"//*[@id=\"react-root\"]/section/div[2]/div/div[1]/div/div[2]/input", "xpath", 10); err == nil && find {
elem, _ := bot.SeleniumStruct.GetElement("//*[@id=\"react-root\"]/section/div[2]/div/div[1]/div/div[2]/input", "xpath")
"//section/div[2]/div/div[1]/div/div[2]/input", "xpath", 10); err == nil && find {
elem, _ := bot.SeleniumStruct.GetElement("//section/div[2]/div/div[1]/div/div[2]/input", "xpath")
log.Debug("Finded an retrieved user searchbar")
if res := simulation.SimulateHandWriting(elem, user); !res {
return false, errors.New("Error during user searching")
Expand Down
5 changes: 3 additions & 2 deletions internal/actions/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ func connectToInstagramWebDriver(bot *types.IGopher) {
}
utils.RandomSleep()
// Accept cookies if requested
if find, err := bot.SeleniumStruct.WaitForElement("//button[text()='Accept All']", "xpath", 10); err == nil && find {
elem, _ := bot.SeleniumStruct.GetElement("//button[text()='Accept All']", "xpath")
if find, err := bot.SeleniumStruct.WaitForElement("//button[text()='Accept All' or text()='Allow essential and optional cookies']",
"xpath", 10); err == nil && find {
elem, _ := bot.SeleniumStruct.GetElement("//button[text()='Accept All' or text()='Allow essential and optional cookies']", "xpath")
elem.Click()
log.Debug("Cookies validation done!")
} else {
Expand Down
4 changes: 2 additions & 2 deletions internal/scrapper/scrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func navigateUserFollowersList(bot *types.IGopher, srcUsername string) (bool, er
}
utils.RandomSleepCustom(1, 3)
// Access to followers list view
if find, err := bot.SeleniumStruct.WaitForElement("//*[@id=\"react-root\"]/section/main/div/ul/li[2]/a", "xpath", 10); err == nil && find {
elem, _ := bot.SeleniumStruct.GetElement("//*[@id=\"react-root\"]/section/main/div/ul/li[2]/a", "xpath")
if find, err := bot.SeleniumStruct.WaitForElement("//section/main/div/ul/li[2]/a", "xpath", 10); err == nil && find {
elem, _ := bot.SeleniumStruct.GetElement("//section/main/div/ul/li[2]/a", "xpath")
elem.Click()
logrus.Debug("Clicked on user followers list")
} else {
Expand Down

0 comments on commit a50f4b0

Please sign in to comment.