selenium-webdriver

Unable to get an element via query on attribute(containing hyphens) value using an XPATH

旧巷老猫 提交于 2021-02-11 12:23:06
问题 I'm facing a very weird scenario in getting an element having an attribute using an XPATH. The problem is that if the attribute contains more than one Hyphens in it then Selenium is unable to find that element. I am using Python and Selenium 2.52.0 Example that works fine. <span data-one="containingOnlyOneHyphen"> </span> XPATH = '//*[@data-one="containingOnlyOneHyphen"]' (Works Completely Fine) Example that doesn't work. <span data-one-two="containingTwoHyphen"> </span> XPATH = '//*[@data

Selenium Chrome webdriver SessionNotCreatedException

戏子无情 提交于 2021-02-11 12:13:37
问题 Using selenium & Chrome webdriver, I'm getting below exception on trying to launch. I have gone through lot of posts and tried all possible ways. I'm using compatible chrome browser and chrome drivers versions - Version 80. Java - 1.8 Windows 10 os The same test when i run on my personal computer, its working. But it's giving below error on my organization s machine. Also, no issues if I use edge drivers. org.openqa.selenium.SessionNotCreatedException: session not created disconnected: unable

Random TimeoutException even after using ui.WebDriverWait() chrome selenium python

梦想与她 提交于 2021-02-11 10:47:31
问题 Random timeout exception for the code below not sure whats the best approach to address these issues, and this timeout not happen all time, and also it does find elements sometime or all time we appreciate your comments and suggestions and apparently explicit wait is not handling until the elements gets loaded into the browser application or elements are getting different interval in every single time when new page gets loaded """ """ import platform , logging import os,re from time import

Chromedriver Save as PDF method not working

核能气质少年 提交于 2021-02-11 07:37:16
问题 Chromedriver Save as PDF method is not working. Before it was working fine but now whenever i run this code it gets on Save as PDF Screen and actually prints the page instead of saving as PDF I tried changing the id but it didn't worked either appState = { "recentDestinations": [ { "id": "Save as PDF", "origin": "local", "margin": 0, 'size': 'auto' } ], "selectedDestinationId": "Save as PDF", "version": 2, "margin": 0, 'size': 'auto' } profile = {'printing.print_preview_sticky_settings

Chromedriver Save as PDF method not working

随声附和 提交于 2021-02-11 07:35:23
问题 Chromedriver Save as PDF method is not working. Before it was working fine but now whenever i run this code it gets on Save as PDF Screen and actually prints the page instead of saving as PDF I tried changing the id but it didn't worked either appState = { "recentDestinations": [ { "id": "Save as PDF", "origin": "local", "margin": 0, 'size': 'auto' } ], "selectedDestinationId": "Save as PDF", "version": 2, "margin": 0, 'size': 'auto' } profile = {'printing.print_preview_sticky_settings

Chromedriver Save as PDF method not working

一曲冷凌霜 提交于 2021-02-11 07:35:13
问题 Chromedriver Save as PDF method is not working. Before it was working fine but now whenever i run this code it gets on Save as PDF Screen and actually prints the page instead of saving as PDF I tried changing the id but it didn't worked either appState = { "recentDestinations": [ { "id": "Save as PDF", "origin": "local", "margin": 0, 'size': 'auto' } ], "selectedDestinationId": "Save as PDF", "version": 2, "margin": 0, 'size': 'auto' } profile = {'printing.print_preview_sticky_settings

Chromedriver Save as PDF method not working

ε祈祈猫儿з 提交于 2021-02-11 07:35:03
问题 Chromedriver Save as PDF method is not working. Before it was working fine but now whenever i run this code it gets on Save as PDF Screen and actually prints the page instead of saving as PDF I tried changing the id but it didn't worked either appState = { "recentDestinations": [ { "id": "Save as PDF", "origin": "local", "margin": 0, 'size': 'auto' } ], "selectedDestinationId": "Save as PDF", "version": 2, "margin": 0, 'size': 'auto' } profile = {'printing.print_preview_sticky_settings

StaleElementReferenceException even when having explicit wait

孤街浪徒 提交于 2021-02-11 06:52:52
问题 I've been trying to crawl data from the website AlgoExplorer. It has a table with pagnigation to store data. Even though I use an Explicit Wait for clicking a 'next' button, it still get StaleException. Here is a piece of my code, and an image of error: for i in tqdm(range(5)): page = driver.find_element_by_tag_name('tbody').find_elements_by_tag_name('a') for e in page: pages.append(e.text) WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.pagination.next'))).click

Selenium webdriver problem with: Expected condition failed: waiting for visibility of element located by(..)

守給你的承諾、 提交于 2021-02-11 05:43:18
问题 I have little problem with my automated test. When my test make error: Expected condition failed: waiting for visibility of element located by(...) and I don't know what is problem. @BeforeMethod public void BeforeTest(){ System.setProperty("webdriver.chrome.driver", "C:/drivers/chromedriver.exe"); driver = new ChromeDriver(); driver.manage().window().maximize(); driver.navigate().to("https://poczta.o2.pl/rejestracja/"); } @Test public void Test(){ WebDriverWait wait = new WebDriverWait

How to click on a button webelement using css_selector with Selenium webdriver for identical button types

血红的双手。 提交于 2021-02-10 22:26:55
问题 For a HTML, <div class="some-class"> <button type="button">Ok</button> <button type="button">Cancel</button> Both button type are the same for two different buttons so how can I click on the Ok button using find_element_by_css_selector? I tried driver.find_element_by_css_selector("div.some-class > button.button[1]").click() but it didn't work for me. 回答1: Use div.some-class > button.button as selector becasue find_element_by_css_selector return the first matched WebElement: driver.find