I have created a bot to auto-update my product prices on Shopify with Selenium Python. I told this bot to locate the price_element clear it, and then send the new prices as a 2 decimal place formated string. e.g. 184.99.
formatted_price = "{:.2f}".format(total_price) # Scroll down to the price element self.driver.find_element(By.TAG_NAME, 'body').send_keys(Keys.PAGE_DOWN) self.driver.find_element(By.TAG_NAME, 'body').send_keys(Keys.PAGE_DOWN) price_element = self.driver.find_element(By.XPATH, '//input[@name="price"]') price_element.clear() price_element.send_keys(formatted_price)
To my surprise, the bot was able to locate the element, but it couldn't clear it and started adding new prices to the previous prices. The image below shows the previous prices of 162.99, 184.99, and 184.99 combined into the price box.