webdriver

Can I test on the order of elements using Selenium Webdriver?

十年热恋 提交于 2020-08-08 07:20:40
问题 There is a form in which there are 3 fields with 3 different ID's: <fieldset> <div><label for="field1"> FIELD1 </label> <textarea id="field1" name="field1" rows="10" cols="40"></textarea></div> <div><label for="field2"> FIELD2 </label><textarea id="field2" name="field2" rows="10" cols="40"></textarea></div> <div><label for="field3"> FIELD3 </label><textarea id="field3" name="field3" rows="10" cols="40"></textarea></div> </fieldset> Now, there is a Story in our scrum process which places

WebDriverManager take incorrect version of driver in selenium

柔情痞子 提交于 2020-08-08 05:32:32
问题 I am trying to run the selenium script through the docker which is installing the chrome browser using following command: RUN dpkg-divert --add --rename --divert /opt/google/chrome/google-chrome.real /opt/google/chrome/google-chrome \ && echo "#!/bin/bash\nexec /opt/google/chrome/google-chrome.real --no-sandbox --disable-setuid-sandbox \"\$@\"" > /opt/google/chrome/google-chrome \ && chmod 755 /opt/google/chrome/google-chrome the above command is installing the chrome browser version 84:

How to capture JavaScript errors with Selenium WebDriver using Java

荒凉一梦 提交于 2020-08-02 13:15:51
问题 I was wondering if there is a way to capture JavaScript errors on a page while running automated Selenium tests. 回答1: There is logs Beta version in WebDriver driver.manage().logs().get(LogType.BROWSER); Will give you the console content. Then you can filter it using Level LogEntries entries = driver.manage().logs().get(LogType.BROWSER); entries.filter(Level.SEVERE); 回答2: And there is one that worked for me. Here it is. public boolean isThereJSErrorOnThePage() { Set<String> errorStrings = new

How to initiate Brave browser using Selenium and Python on Windows

冷暖自知 提交于 2020-07-23 06:07:29
问题 Using: ChromeDriver 83.0.4103.39 Brave Version 1.10.97 Chromium: 83.0.4103.116 (Official Build) (64-bit) Python 3.7 Windows 10 Code trials: from selenium import webdriver driver_path = "C:/Users/username/PycharmProjects/chromedriver.exe" brave_path = "C:/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe" option = webdriver.ChromeOptions() option.binary_location = brave_path # option.add_argument("--incognito") OPTIONAL # option.add_argument("--headless") OPTIONAL # Create

How to initiate Brave browser using Selenium and Python on Windows

↘锁芯ラ 提交于 2020-07-23 06:06:18
问题 Using: ChromeDriver 83.0.4103.39 Brave Version 1.10.97 Chromium: 83.0.4103.116 (Official Build) (64-bit) Python 3.7 Windows 10 Code trials: from selenium import webdriver driver_path = "C:/Users/username/PycharmProjects/chromedriver.exe" brave_path = "C:/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe" option = webdriver.ChromeOptions() option.binary_location = brave_path # option.add_argument("--incognito") OPTIONAL # option.add_argument("--headless") OPTIONAL # Create

How to initiate Brave browser using Selenium and Python on Windows

回眸只為那壹抹淺笑 提交于 2020-07-23 06:05:12
问题 Using: ChromeDriver 83.0.4103.39 Brave Version 1.10.97 Chromium: 83.0.4103.116 (Official Build) (64-bit) Python 3.7 Windows 10 Code trials: from selenium import webdriver driver_path = "C:/Users/username/PycharmProjects/chromedriver.exe" brave_path = "C:/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe" option = webdriver.ChromeOptions() option.binary_location = brave_path # option.add_argument("--incognito") OPTIONAL # option.add_argument("--headless") OPTIONAL # Create

Selenium Java - Page Object Model Query

江枫思渺然 提交于 2020-07-22 21:40:53
问题 Imagine there is a page say http://google.com/AddUser and here you enter details for a record and click save. Once you do this the page redirects to http://google.com/userList where you can see list of users including the new record you just entered. If we are going by page object model, the method to enter details and save record should exist on AddUser.java and the method to validate if the record was actually saved and displayed should be on UserList.java If we consider addUser and

How to explicitly wait while using page factory in Selenium?

橙三吉。 提交于 2020-07-20 17:06:58
问题 I'm going to organize an explicit wait in Selenium like this: WebDriverWait = new WebDriverWait(driver,30); WebElement element = wait.until(ExpectedConditions.presenceOfElementLocated(locator)); The problem is that I don't have the driver in my class, because I used the PageFactory, not a constructor in a test class: MyClass myform = PageFactory.InitElements(driver, MyClass.class) What is a good decision to organize explicit wait in this case? 回答1: I would suggest that you use the PageFactory

Selenium Threads: how to run multi-threaded browser with proxy ( python)

南楼画角 提交于 2020-07-18 15:56:45
问题 I'm writing a script to access a website using proxies with multiple threads but now I'm stuck in multiple threads, when I run the script below, it opens 5 browsers but all 5 use 1 proxy, I want 5 browsers to use different proxies, can someone help me complete it? thank you Here is my script : from selenium import webdriver from selenium import webdriver import time , random import threading def e(): a = open("sock2.txt", "r") for line in a.readlines(): b = line prox = b.split(":") IP = prox

How does this website detect remote control with selenium and chromedriver?

左心房为你撑大大i 提交于 2020-07-15 08:02:05
问题 I’m trying to screen scrape my own credit card information from the Discover website using selenium and chromedriver. In response it returns the error: Your account cannot currently be accessed. Outdated browsers can expose your computer to security risks. To get the best experience on Discover.com, you may need to update your browser to the latest version and try again. Interestingly, if I write a script to open a headed browser and type in some random account and password, it works normally