selenium-webdriver

org.openqa.selenium.WebDriverException: invalid argument: 'handle' must be a string while window handling with Selenium and Java in Linux

痴心易碎 提交于 2020-05-16 12:07:12
问题 I have an requirement of running test cases in CI pipeline. where the VM is linux. Selenium multiple window handling - switchTo() method throws exception for linux platform. Exception: org.openqa.selenium.WebDriverException: invalid argument: 'handle' must be a string Code trials: driver.switchTo().window(subWindowHandler); Its declared as per multiple window handle way: String subWindowHandler = null; Set<String> handles = driver.getWindowHandles(); Iterator<String> iterator = handles

Navigating to a new page through Selenium in Python

回眸只為那壹抹淺笑 提交于 2020-05-16 05:17:31
问题 How do I navigate to another webpage using the same driver with Selenium in python? I do not want to open a new page. I want to keep on using the same driver. I thought that the following would work: driver.navigate().to("https://support.tomtom.com/app/contact/") But it doesn't! Navigate seems not to be a 'WebDriver' method 回答1: To navigate to a webpage you just write driver.get(__url__) you can do this in your program multiple times 回答2: The line of code which you have tried as : driver

How to use 'not start-with' attribute of xpath in selenium to skip certain websites in python

妖精的绣舞 提交于 2020-05-16 03:24:06
问题 I've written a code which asks the user for input and opens duckduckgo to search for the website related to that input value. In the search results, I want to open the website which doesn't start with the website mentioned by me in //a[not(starts-with(@href, 'website'))] .This is my code: from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains import time import pyautogui from selenium.common.exceptions

Python and Selenium - Close all tabs without closing the browser

放肆的年华 提交于 2020-05-15 11:12:35
问题 I want to close all open tabs (browser windows) without actually closing the driver, because I want to keep using it. driver.close() will just close the focused tab. driver.quit() will close them all but also quit the driver. I thought about using driver.quit() and then re-opening the driver. But it does not seem very clean. Or maybe it is super clean, but also a slow thing to do. Note : Using Firefox via geckodriver How can I approach this? 回答1: You can close the tabs by sending ctrl + w to

Python and Selenium - Close all tabs without closing the browser

戏子无情 提交于 2020-05-15 11:12:10
问题 I want to close all open tabs (browser windows) without actually closing the driver, because I want to keep using it. driver.close() will just close the focused tab. driver.quit() will close them all but also quit the driver. I thought about using driver.quit() and then re-opening the driver. But it does not seem very clean. Or maybe it is super clean, but also a slow thing to do. Note : Using Firefox via geckodriver How can I approach this? 回答1: You can close the tabs by sending ctrl + w to

Python and Selenium - Close all tabs without closing the browser

两盒软妹~` 提交于 2020-05-15 11:08:27
问题 I want to close all open tabs (browser windows) without actually closing the driver, because I want to keep using it. driver.close() will just close the focused tab. driver.quit() will close them all but also quit the driver. I thought about using driver.quit() and then re-opening the driver. But it does not seem very clean. Or maybe it is super clean, but also a slow thing to do. Note : Using Firefox via geckodriver How can I approach this? 回答1: You can close the tabs by sending ctrl + w to

Using Actions able to select element but not able drag element to particular location, because drop functionality is created on hover

前提是你 提交于 2020-05-15 03:03:29
问题 URL - http://www.seleniumeasy.com/test/drag-and-drop-demo.html System.setProperty("webdriver.chrome.driver", "D:\\Eclipse\\Files\\chromedriver_win32\\chromedriver.exe"); driver = new ChromeDriver(); driver.manage().window().fullscreen(); driver.get("http://www.seleniumeasy.com/test/drag-and-drop-demo.html"); Thread.sleep(5000); WebElement itemToBeDragged = driver.findElement(By.xpath("//div[@id='todrag']//span[3]")); WebElement whereToBeDragged = driver.findElement(By.xpath("//div[@id=

“TypeError: 'module' object is not callable” with webdriver.chrome

折月煮酒 提交于 2020-05-15 02:39:31
问题 from selenium import webdriver driver = webdriver.chrome("F:\\chromedriver.exe") driver.get("https://www.nvidia.in/graphics-cards/geforce/pascal/buy/") 回答1: In python, letter 'c' will be in upper case in the function chrome(). INCORRECT import webdriver driver = webdriver.chrome("F:\\chromedriver.exe") PROPER: from selenium import webdriver import selenium driver = webdriver.Chrome("F:\\Chromedriver.exe") 回答2: from selenium import webdriver import selenium driver = webdriver.Chrome() driver

SeleniumBasic VBA Fastest Loop of WebElements using a WebElement method

守給你的承諾、 提交于 2020-05-14 12:48:13
问题 I'm noticing a rather long time for an operation to complete. I'm using the latest SeleniumBasic for VBA to extract data from a table using a ChromeDriver. (https://github.com/florentbr/SeleniumBasic) I'm retrieving WebElements and looping through them to get the text value. I'm assigning the text value to an array of type String. This operation takes quite a long time when I have a large array (1000's of WebElement objects). Question - What is the fastest way to get all the text values? Here

How to handle Windows file upload in .Net core using Selenium?

不问归期 提交于 2020-05-14 10:25:49
问题 I am new to the C# world and I want to know how can a Windows file upload form be automated using Selenium in a .Net core project as it doesn't support AutoIt. 回答1: Zehra - It really depends on how precise you want to get to mimicking the user functionality. Typically you click a button that opens a windows dialog where you locate the file on your pc/phone. Since this is really not testing the application and is just a Windows function, I just use send keys. If you want to get more precise,