missing attribute with new selenium update, not able to click in page

Viewed 40

I am new, Sorry if I did something wrong.

I want to get on a website to get some information. one page has 12 items, I have to click on all 12 items to get the info and get to the next page.

the problem I am facing now is, that I am not able to click on the item. I was using a loop and appending all the items from all the pages, then clicking in to collect info.

Python3, selenium 4.4.3 the code under class

def getProductLinks(self): 
  for i in range(2):
    for j in range (1,5):         
    self.productLinks.append( self.br.readTheElement("xpath",'//*[@id="div_content"]/div[2]/div/div[3]/div/div['+str(j)+']') )
    self.productLinks.append( self.br.readTheElement("xpath",'//*[@id="div_content"]/div[2]/div/div[4]/div/div['+str(j)+']') )
    self.productLinks.append( self.br.readTheElement("xpath",'//*[@id="div_content"]/div[2]/div/div[5]/div/div['+str(j)+']') )
        
  self.nextPage()
  time.sleep(5)
  self.printall()

the problem is in this part, as I update the selenium, so find_element(xpath)->find_element(xpath,xPath), but here, this self productLinks is list,if I just run it, will miss attribute,and I have no idea what to put it in

def visitLinks(self): 
  for link in self.productLinks:
  ***self.br.clickOnElement(self.productLinks)***

    self.br.changeSite(link)  
    self.getName() 
    self.br.goBack()

ref:

 def clickOnElement(self,xpath,xPath):
    element = self.browser.find_element(xpath,xPath)    
    element.click()
0 Answers
Related