How to click on a element through Selenium Python

The element with text as Export is a dynamically generated element so to locate the element you have to induce WebDriverWait for the element to be clickable and you can use either of the Locator Strategies: Using CSS_SELECTOR: WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, “a.layerConfirm>div[data-hover=”tooltip”][data-tooltip-display=’overflow’]”))).click() Using XPATH: WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH, “//button[contains(@class, ‘layerConfirm’)]/div[@data-hover=”tooltip” and text()=’Export’]”))).click() Note : You have to add … Read more

What do commas and spaces in multiple classes mean in CSS?

.container_12 .grid_6, .container_16 .grid_8 { width: 460px; } That says “make all .grid_6’s within .container_12’s and all .grid_8’s within .container_16’s 460 pixels wide.” So both of the following will render the same: <div class=”container_12″> <div class=”grid_6″>460px Wide</div> </div> <div class=”container_16″> <div class=”grid_8″>460px Wide</div> </div> As for the commas, it’s applying one rule to multiple classes, … Read more

NoSuchElementException, Selenium unable to locate element

NoSuchElementException org.openqa.selenium.NoSuchElementException popularly known as NoSuchElementException extends org.openqa.selenium.NotFoundException which is a type of WebDriverException. NoSuchElementException can be thrown in 2 cases as follows : When using WebDriver.findElement(By by) : //example : WebElement my_element = driver.findElement(By.xpath(“//my_xpath”)); When using WebElement.findElement(By by) : //example : WebElement my_element = element.findElement(By.xpath(“//my_xpath”)); As per the JavaDocs just like any other WebDriverException, … Read more

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element while trying to click Next button with selenium

This error message… selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”name”,”selector”:”submitNext”} (Session info: chrome=66.0.3359.170) (Driver info: chromedriver=2.36.540470) …implies that the ChromeDriver was unable to locate the desired element. Locating the desired element As per the HTML you have shared to click on the element you can use either of the following Locator Strategies … Read more

What does the “>” (greater-than sign) CSS selector mean?

> is the child combinator, sometimes mistakenly called the direct descendant combinator.1 That means the selector div > p.some_class only matches paragraphs of .some_class that are nested directly inside a div, and not any paragraphs that are nested further within. This implies that every element matching div > p.some_class necessarily also matches div p.some_class, with … Read more