webdriverwait

Probable impact of implicit wait removal

浪尽此生 提交于 2020-01-11 10:25:10
问题 In our Selenium automated tests, we've implicit and explicit waits. As per Jim Evan's thought https://stackoverflow.com/a/15174978/1471417, they should not be mixed. Hence planning to remove implicit wait. For our tests, whenever we interact with an element, we've used explicit wait for it to be visible, clickable etc. with ignoring NoSuchElementException . That's why I don't think, it will throw NoSuchElementException immediately. This makes sure removing implicit wait won't affect my tests.

How to retrieve the title attribute through Selenium using Python?

那年仲夏 提交于 2020-01-09 03:57:44
问题 This is my code : print(browser.find_element_by_partial_link_text("followers").get_attributes("title")) . I am using find_element_by_partial_link_text because maybe the xpath could be unique for each user. But my code returns nothing. This is the element's adress: <li class=" LH36I"> <a class=" _81NM2" href="/username/followers/"> <span class="g47SY lOXF2" title="3,862,378">3.8m</span> " followers" </a> </li> So my question is how can i get the value in the title using find_element_by_partial

Trying to select link text within a table cell if the desired text is also within the cell

荒凉一梦 提交于 2020-01-05 13:08:28
问题 So I have a table cell that contains both text and a link. Now every row in this table has the same text link hyperlink title "[Details]" but the location changes on where it takes you based on which row you are in. For example the cell will look like this: "Text I Want" [Details] I want to be able to go to the correct link based on what text is also within that cell, but am having some issues figuring out how to code that in Python. Once a row in this table is clicked it moves it location in

Trying to select link text within a table cell if the desired text is also within the cell

冷暖自知 提交于 2020-01-05 13:07:59
问题 So I have a table cell that contains both text and a link. Now every row in this table has the same text link hyperlink title "[Details]" but the location changes on where it takes you based on which row you are in. For example the cell will look like this: "Text I Want" [Details] I want to be able to go to the correct link based on what text is also within that cell, but am having some issues figuring out how to code that in Python. Once a row in this table is clicked it moves it location in

How to scrap data from webpage which uses react.js with Selenium in Python?

落爺英雄遲暮 提交于 2020-01-05 04:20:07
问题 I am facing some difficulties scraping a website which uses react.js and not sure why this is happening. This is the html of the website: What I wish to do is click on the button with the class: play-pause-button btn btn -naked . However, when I load the page with the Mozilla gecko webdriver there is an exception thrown saying Message: Unable to locate element: .play-pause-button btn btn-naked which makes me think that maybe I should do something else to get this element? This is my code so

Selenium Python does not close the child window

£可爱£侵袭症+ 提交于 2020-01-02 09:32:47
问题 I have webpage which open new browser window on click. I am able to get 2 handles however driver.close() always closes the first/main window. from selenium import webdriver import time driver = webdriver.Chrome() driver.get("file:///D:/blackhole/print.html") han = driver.window_handles print("handles:", han) # gets 1 handle time.sleep(2) click_btn = driver.find_element_by_link_text('Print') click_btn.click() han = driver.window_handles print("handles:", han) # gets 2 handles driver.switch_to

sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) using findElement(By.className()) through Selenium and Java

旧巷老猫 提交于 2019-12-31 05:26:09
问题 When I execute the following code: driver.findElement(By.className("qview-product-name")).click(); I get the following error Session ID: d5df6f837164b1738991e8dc09027fe0 *** Element info: {Using=class name, value=qview-product-name} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor

select kendo dropdown using selenium python

倖福魔咒の 提交于 2019-12-31 05:03:21
问题 Unable to select the kendo dropdown using below code. The site can be reachable for checking the code. <span unselectable="on" class="k-dropdown-wrap k-state-default"><span unselectable="on" class="k-input">Chang</span><span unselectable="on" class="k-select" aria-label="select"><span class="k-icon k-i-arrow-60-down"></span></span></span> Code: from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support.select import Select

How to wait for either of the two elements in the page using selenium xpath

会有一股神秘感。 提交于 2019-12-30 13:12:53
问题 I have two elements I can wait for, I want to wait until either of them appears on the page. I am trying to use xpath locator. But it is not working. By.xpath("//*[(contains(@id,'idNumber1')) or (contains(@id,'idNumber2'))]")); Is this achievable? Please help me out. 回答1: It is possible to wait for one of two elements in the page using ExpectedConditions.or() : WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(ExpectedConditions.or( ExpectedConditions.elementToBeClickable(By.id(

“unknown error: cannot read property 'scrollleft' of null” in Chrome using selenium

限于喜欢 提交于 2019-12-29 09:55:46
问题 In Chrome when I am clicking button, I am getting "unknown error: cannot read property 'scrollleft' of null Their is 1 Input field in that page I am able to enter value in that only Button click is not working. This Click is working fine in Firefox. issue only in Chrome IWebElement element = wait.Until(d => d.FindElement(locator)); wait.Until(ExpectedConditions.ElementToBeClickable(element)); element.Click(); Note: There is no frames in this page, no scrolls. 回答1: You need to invoke Click()