selenium-webdriver

How to extract html through Javascript executor?

孤街浪徒 提交于 2021-02-10 13:27:08
问题 import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; public class oo { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver","D:\\Java\\Lib\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.navigate().to("https://google.com"); JavascriptExecutor js = (JavascriptExecutor) driver; Object s = js.executeScript("return document.body.innerHTML;",null).toString(); System

How to identify a particular Page Object fragment member element through Selenium

淺唱寂寞╮ 提交于 2021-02-10 12:53:01
问题 In our project we have multiple selenium tests run with cucumber which are testing specific components. One of these components are two identifiers, which we call country identifier and site identifier. These have the following HTML: <div class="identifiers"> <div class="country-identifier"> <span class="ident-label"> Germany </span> </div> <div class="site-identifier"> <span class="ident-label"> Gaming </span> </div> </div> Now our tests have two models, one for each identifier: @PageObject

How to count the elements from a class with VBA + SELENIUM in chrome?

一世执手 提交于 2021-02-10 12:26:08
问题 I want to count the numbers of elements aiming to get all their names and store in an array. The names are highlighted in this image The names are store in "js-list list-wrapper" as shown in image My code: Public Sub seleniumtutorial() Dim bot As New SeleniumWrapper.WebDriver Dim a As WebElement Dim b As WebElement Dim x() As Integer bot.Start "chrome", "https://trello.com/login" bot.get "/" bot.Type "name=user", "biaverly@id.uff.br" bot.Type "name=password", "carambola69" bot.clickAndWait

How to count the elements from a class with VBA + SELENIUM in chrome?

╄→尐↘猪︶ㄣ 提交于 2021-02-10 12:25:28
问题 I want to count the numbers of elements aiming to get all their names and store in an array. The names are highlighted in this image The names are store in "js-list list-wrapper" as shown in image My code: Public Sub seleniumtutorial() Dim bot As New SeleniumWrapper.WebDriver Dim a As WebElement Dim b As WebElement Dim x() As Integer bot.Start "chrome", "https://trello.com/login" bot.get "/" bot.Type "name=user", "biaverly@id.uff.br" bot.Type "name=password", "carambola69" bot.clickAndWait

How to change Allow sites to save and read cookie data (recommended) and/or Block third-party cookies

半城伤御伤魂 提交于 2021-02-10 12:13:30
问题 I've requirement to test webpages using Selenium with below cookies settings 1. Allow sites to save and read cookie data (recommended) 2. Block third-party cookies I found link how to disable cookies using webdriver for Chrome and FireFox JAVA, which does setting at global level and not individual setting under Cookies. 回答1: It depends on the driver. With Chrome and Firefox you can set the behavior by setting the preferences with the driver. Preferences with Chrome to allow/block the cookies:

How to change Allow sites to save and read cookie data (recommended) and/or Block third-party cookies

你。 提交于 2021-02-10 12:11:17
问题 I've requirement to test webpages using Selenium with below cookies settings 1. Allow sites to save and read cookie data (recommended) 2. Block third-party cookies I found link how to disable cookies using webdriver for Chrome and FireFox JAVA, which does setting at global level and not individual setting under Cookies. 回答1: It depends on the driver. With Chrome and Firefox you can set the behavior by setting the preferences with the driver. Preferences with Chrome to allow/block the cookies:

Undetected Chromedriver not loading correctly

放肆的年华 提交于 2021-02-10 07:06:49
问题 I'm attempting to use a headless chrome browser with selenium that also bypasses the bot detection test and currently using the the following project https://github.com/ultrafunkamsterdam/undetected-chromedriver Every time I try to implement the code it doesn't recognise the driver. Here is the link for you to understand Here is the code # # UNDETECTED chromedriver (headless,even) # import undetected_chromedriver as uc options = uc.ChromeOptions() options.headless=True options.add_argument('-

Why is throw new SkipException() skipping all my methods?

我的未来我决定 提交于 2021-02-10 06:53:29
问题 Why is throw new SkipException() skipping all my methods across all classes? Class one has a method which fails therefore the remaining methods in that class are skipped and the skipcounter is set to 0. Class two should execute all methods and all methods should pass in class two because the skip counter was set to 0 and after class one was executed. The following code seems to skip all methods even though there is only one assert.fail which is contained in class one? Test Base: import org

jenkins selenium do not run test headlessly

╄→гoц情女王★ 提交于 2021-02-10 06:45:47
问题 I am running pytests selenium tests using jenkins. I ran test on my local machine it works. But when I run through jenkins, it runs on remote jenkins machine(creates workspace on remote jenkins machine) headlessly and it fails with test errors such as 'element not visible' or 'timeout exception due to element not clickable'. After this I ran test on remote machine directly (windows server) in workspace. It launches chrome browser and runs test and passes. Why is it running test headlessly

How to prevent (python) Selenium webdriver from triggering “Microsoft Malicious Software Removal Tool” to ask if it may reset browser settings?

爱⌒轻易说出口 提交于 2021-02-10 06:39:08
问题 Recently Selenium chrome webdriver started to run into problems by triggering Microsoft Malicious Software Removal Tool to request if it may reset browser settings. How to get around this? Is there an argument to add to options like --disable-extensions solved a popup problem before? from selenium import webdriver options = webdriver.chrome.options.Options() options.add_argument("--disable-extensions") driver = webdriver.Chrome(chrome_options=options) A temporary solution may be driver.find