def proceedToPricing(self, browser): # proceedToPricingButton = browser.find_element_by_xpath("//*[contains(text(), 'Proceed to pricing')]") proceedToPricingButton = self.waitUntilElementLocatedByXpath(browser, "//*[contains(text(), 'Proceed to pricing')]") proceedToPricingButton.click() printfulAutomation.waitForPageLoad()
def navigateToSwimwear(self, browser): swimwearButton = browser.find_element_by_xpath("//h3[text()= 'Swimwear']") browser.execute_script("arguments[0].scrollIntoView();", swimwearButton) printfulAutomation.waitForPageLoad() swimwearButton.click()
def navigateToCreateProductStyle(self, browser, productStyle): # Prerequisite: Must be in a category, like navigateToMensAllOverShirts productStyleButton = browser.find_elements_by_xpath("//*[contains(text(), '%s')]" % productStyle)[-1] #last one in the ist AKA theone in the modal # productStyleButton = self.waitUntilElementLocatedByXpath(browser, "//*[contains(text(), '" + productStyle + "')]") productStyleButton.click() printfulAutomation.waitForPageLoad()
def navigateToLeggings(self, browser): leggingsButton = browser.find_element_by_xpath("//h3[text()= 'Leggings']") browser.execute_script("arguments[0].scrollIntoView();", leggingsButton) printfulAutomation.waitForPageLoad() leggingsButton.click()
def navigateToFlipFlops(self, browser): self.navigateToAccessories(browser) flipFlopsButton = browser.find_element_by_xpath("//a[text()= 'Flip flops']") browser.execute_script("arguments[0].scrollIntoView();", flipFlopsButton) printfulAutomation.waitForPageLoad() flipFlopsButton.click()
def goToChooseProduct(self, browser): browser.get("https://www.printful.com/dashboard/sync?store=" + patternPopStoreId) # printfulAutomation.waitForPageLoad() # addProductButton = browser.find_element_by_xpath("//*[text()='Add product']") addProductButton = self.waitUntilElementLocatedByXpath(browser, "//*[text()='Add product']") addProductButton.click() printfulAutomation.waitForPageLoad()
def proceedToProductDescription(self, browser): # proceedToMockupsButton = browser.find_element_by_xpath("//*[contains(text(), 'Proceed to mockups')]") proceedToMockupsButton = self.waitUntilElementLocatedByXpath(browser, "//*[contains(text(), 'Proceed to mockups')]") proceedToMockupsButton.click() # proceedToDescriptionButton = browser.find_element_by_xpath("//*[contains(text(), 'Proceed to description')]") proceedToDescriptionButton = self.waitUntilElementLocatedByXpath(browser, "//*[contains(text(), 'Proceed to description')]") proceedToDescriptionButton.click() printfulAutomation.waitForPageLoad()
def clickAllColorsCheckboxIfAvailable(self, browser): checkboxValue = 'Select all colors' try: browser.find_element_by_xpath(".//span[text()='%s']" % checkboxValue) except NoSuchElementException: return allColorsCheckbox = browser.find_element_by_xpath(".//span[text()='%s']" % checkboxValue) browser.execute_script("arguments[0].scrollIntoView();", allColorsCheckbox) allColorsCheckbox.click() printfulAutomation.waitForPageLoad()
def chooseItemColorIfAvailable(self, browser, itemPiece, color, mirror=False): itemPieceTab = self.findElement(browser, itemPiece) if itemPieceTab == False: return browser.execute_script("arguments[0].scrollIntoView();", itemPieceTab) itemPieceTab.click() if mirror: color += '_mirror' self.chooseColor(browser, color) printfulAutomation.waitForPageLoad()
def chooseColor(self, browser, colorName): uploadFileButton = browser.find_element_by_xpath("//*[contains(text(), 'Upload file')]") browser.execute_script("arguments[0].scrollIntoView();", uploadFileButton) uploadFileButton.click() printfulAutomation.waitForPageLoad() colorSearch = browser.find_elements_by_xpath("//input[contains(@id,'library-search')]")[-1] colorSearch.send_keys(colorName, Keys.ENTER) # printfulAutomation.waitForPageLoad() # frontColorChooserButton = browser.find_element_by_xpath('//*[@title="%s.png"]' % colorName) frontColorChooserButton = navigationFunctions.NavigationFunctions.waitUntilElementLocatedByXpath(self, browser, '//*[@title="' + colorName + '.png"]') frontColorChooserButton.click() printfulAutomation.waitForPageLoad()