Skip to content

Commit

Permalink
fix: invalid id selector in some xpaths (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbollon committed Mar 21, 2022
1 parent 6791f63 commit b220352
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func (bot *IGopher) sendMessageWebDriver(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 := SimulateHandWriting(elem, user); !res {
return false, errors.New("Error during user searching")
Expand Down
4 changes: 2 additions & 2 deletions scrapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ func (sc *IGopher) navigateUserFollowersList(srcUsername string) (bool, error) {
}
randomSleepCustom(1, 3)
// Access to followers list view
if find, err := sc.SeleniumStruct.WaitForElement("//*[@id=\"react-root\"]/section/main/div/ul/li[2]/a", "xpath", 10); err == nil && find {
elem, _ := sc.SeleniumStruct.GetElement("//*[@id=\"react-root\"]/section/main/div/ul/li[2]/a", "xpath")
if find, err := sc.SeleniumStruct.WaitForElement("//section/main/div/ul/li[2]/a", "xpath", 10); err == nil && find {
elem, _ := sc.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 b220352

Please sign in to comment.