selenium

[WinError 2]FileNotFoundError in python Selenium webDriver

匆匆过客 提交于 2021-02-17 06:57:22
问题 I'm started to learn python Selenium. I just downloaded by pip pip install python-selenium and started to write first lines and at this moment appeares >>> from selenium import webdriver >>> from selenium.webdriver.common.keys import Keys >>> driver = webdriver.Firefox() [WinError2] FileNotFoundError... ... Then I tried it with Chrome but appeares the same thing. Who can solve this problem? 回答1: You do following things and check whether it works. Upgrade python bindings using pip install -U

size() option is missing using Selenium webdriver through Java

别来无恙 提交于 2021-02-17 06:48:24
问题 have been following some classes to improve my automation skills with Selenium Webdrive. I don't have size() method as an option when trying to count the numbers of links inside a page. Am I missing some jars? Import libraries? java public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "/Users/Follo/Dropbox/Chrome Drivers/chromedriver"); ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized"); //

How to run a Java Selenium test on an incognito Google Chrome profile

本小妞迷上赌 提交于 2021-02-17 06:43:06
问题 I hope that you're fine. I'm trying to run a certain test on a certain profile but using incognito mode here what I did, it opens the incognito WebDriver of the profile but it doesn't run the test: import org.openqa.selenium.By; import org.openqa.selenium.By.ByXPath; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; //import

How to get past a cookie agreement page using Python and Selenium?

随声附和 提交于 2021-02-17 06:09:58
问题 I am quite new to selenium and python. I am trying to navigate through a webpage (https://www.heise.de/download/) but can't get passed the cookiewall (cookie agreement page). It seems that the webdriver can't find the button to click on. The HTML code: <button type="button" backgroundcolor="[object Object]" data-testid="uc-accept-all-button" fullwidth="true" class="sc-bdnylx fmRkNf">Alles akzeptieren</button> from selenium import webdriver from time import sleep from selenium.webdriver.common

Accepting cookies error with Python/Selenium on www.instagram.com

久未见 提交于 2021-02-17 06:00:24
问题 I'm trying to, using Firefox, log into Instagram by using Python Selenium using the following code: from time import sleep from selenium import webdriver browser = webdriver.Firefox() browser.implicitly_wait(5) browser.get('https://www.instagram.com/') sleep(2) username_input = browser.find_element_by_css_selector("input[name='username']") password_input = browser.find_element_by_css_selector("input[name='password']") username_input.send_keys("<your username>") password_input.send_keys("<your

Is there way to disable CORS check using RemoteWebDriver for SauceLabs

我只是一个虾纸丫 提交于 2021-02-17 05:54:05
问题 Question says it all, I m trying to execute some selenium tests on SauceLabs, the test loads a webpage that makes a cross domain request. I was thinking is there a way to disable CORS, in platform-independent way through code. 回答1: While using ChromeDriver / Chrome combo to disable cors check you can use the --disable-web-security argument. which is defined in content_switches.cc as: // Don't enforce the same-origin policy. (Used by people testing their sites.) const char kDisableWebSecurity[

Protractor - Find all elements and loop length of found elements and click button

北慕城南 提交于 2021-02-17 05:36:07
问题 So I have been trying to figure out on how to click a button x times depending on how many find All elements are. Meaning if there is 3 elements that is found by the same classname then we loop 3 times which should click the button 3 times. I have done something like this: (New update, check edit post at the bottom) Usually the element.all(by.className('btn btn-remove btn-outlined')).getText() is 3 but can be changed to 6 and random numbers so my idea was to read first how many btn btn-remove

Protractor - Find all elements and loop length of found elements and click button

被刻印的时光 ゝ 提交于 2021-02-17 05:35:09
问题 So I have been trying to figure out on how to click a button x times depending on how many find All elements are. Meaning if there is 3 elements that is found by the same classname then we loop 3 times which should click the button 3 times. I have done something like this: (New update, check edit post at the bottom) Usually the element.all(by.className('btn btn-remove btn-outlined')).getText() is 3 but can be changed to 6 and random numbers so my idea was to read first how many btn btn-remove

Scraping javascript table with a scroll using selenium

江枫思渺然 提交于 2021-02-17 05:26:21
问题 I am trying to scrape a table which is being generated through javascript but I am struggling. My code so far is: driver = webdriver.Chrome(); driver.get("https://af.ktnlandscapes.com/") # get table -- first wait for table to fully load WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, "//*[@id='list-view']/tbody/tr"))) table = driver.find_element_by_xpath("//*[@id='list-view']") # get rows rows = table.find_elements_by_xpath("tbody/tr") # iterate rows and get

Creating New Tabs and Managing Them - Selenium

[亡魂溺海] 提交于 2021-02-17 05:24:19
问题 Here is my Code: var chromeOptions = new ChromeOptions(); chromeOptions.AddArguments("headless"); _driver = new OpenQA.Selenium.Chrome.ChromeDriver(chromeOptions); _driver.Navigate().GoToUrl(url); It will open an instance of chromedriver.exe and will navigate to the target URL. I need to navigate to other URLs with the same chromedriver.exe intance, and I need to set specific headers and cookies for each URL. How to achieve something with Selenium and ChromeDriver? 回答1: Personally, i;d do