Selenium- Python - Please help

from selenium import webdriver
import time

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait

class Bot:

def __init__(self, Username, Password, firstName, lastName, checkPin, address, city, apt, state, phone, cardCvv,
             chrome_path):
    self.Username = Username
    self.Password = Password
    self.checkPin = checkPin
    self.firstName = firstName
    self.lastName = lastName
    self.address = address
    self.city = city
    self.apt = apt
    self.state = state
    self.phone = phone
    self.cardCvv = cardCvv
    self.driver = webdriver.Chrome(chrome_path)
    self.driver.get('https://shopatsc.com/account/login')


def add_ps5_to_cart_and_checkout(self):

    addToCart = '//div[contains(@class,"groups-btn prod_id")]/input[@id = "product-add-to-cart"]'
    viewCart = '//a[@class= "btn btn-view-cart"]'
    checkPin = '//input[@id= "pincode_input"]'
    checkBtn = '//span[@id="check-delivery-submit"]'
    proceedToCheckout = '//input[@id= "checkout_button"]'
    self.waitforAddtoCartBtn(addToCart)
    self.clickButton(viewCart)
    self.enterData(checkPin, self.checkPin)
    self.clickButton(checkBtn)
    self.clickButton(proceedToCheckout)



def waitforAddtoCartBtn(self, xpath):

    while True:
        try:
            WebDriverWait(self, 10).until(
                EC.presence_of_element_located(By.XPATH.click()))

            break
        except Exception:
            self.driver.refresh(self, xpath)
            continue

I am getting below error :

refresh() takes 1 positional argument but 3 were given

If I remove both arguments from refresh() programs keep on refreshing the page when it go to add he item to the cart.

@paawann Welcome to the forum.

I think the error is because you have two self keywords in the same line.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.