XPATH selector by class or Text
Old
close_button = self.driver.find_element_by_xpath('//*[@class="msg-overlay-bubble-header__control artdeco-button artdeco-button--circle artdeco-button--muted artdeco-button--1 artdeco-button--tertiary ember-view"]')
close_button.click()
New syntax and text() function is used in example
self.driver.find_element(By.XPATH, '//button[text()="Login"]').click()
self.driver.find_element(By.CLASS_NAME, 'MuiButton-containedPrimary').click()
self.driver.find_element(By.XPATH, '//button[class="MuiButton-containedPrimary"]').click()
Scroll into view Javascript
#self.driver.execute_script("window.scrollBy(0, 40);")
self.driver.execute_script("arguments[0].scrollIntoView(true);", button)
sleep(self.timeout)
self.driver.execute_script("return arguments[0].remove();", button)
Comments
Post a Comment