selenium

Not able to get element by xpath inside div with ::before

假装没事ソ 提交于 2021-02-11 02:11:14
问题 I need to get the list of web elements by using web driver object findElements(By.xpath("")); I get the list by using xpath as //*[@class=\"providers-list clearfix\"] .However, I get an error whenever I try to fetch element inside <div class="providers-list clearfix">::before <div class="data-container">..</div> </div> This xpath gives me error: // [@class=\"data-container\"]" as no such element: Unable to locate element: {"method":"xpath","selector":"// [@class="data-container"]"} 回答1:

Not able to get element by xpath inside div with ::before

南楼画角 提交于 2021-02-11 02:04:34
问题 I need to get the list of web elements by using web driver object findElements(By.xpath("")); I get the list by using xpath as //*[@class=\"providers-list clearfix\"] .However, I get an error whenever I try to fetch element inside <div class="providers-list clearfix">::before <div class="data-container">..</div> </div> This xpath gives me error: // [@class=\"data-container\"]" as no such element: Unable to locate element: {"method":"xpath","selector":"// [@class="data-container"]"} 回答1:

Not able to get element by xpath inside div with ::before

这一生的挚爱 提交于 2021-02-11 02:01:21
问题 I need to get the list of web elements by using web driver object findElements(By.xpath("")); I get the list by using xpath as //*[@class=\"providers-list clearfix\"] .However, I get an error whenever I try to fetch element inside <div class="providers-list clearfix">::before <div class="data-container">..</div> </div> This xpath gives me error: // [@class=\"data-container\"]" as no such element: Unable to locate element: {"method":"xpath","selector":"// [@class="data-container"]"} 回答1:

Not able to get element by xpath inside div with ::before

微笑、不失礼 提交于 2021-02-11 01:59:03
问题 I need to get the list of web elements by using web driver object findElements(By.xpath("")); I get the list by using xpath as //*[@class=\"providers-list clearfix\"] .However, I get an error whenever I try to fetch element inside <div class="providers-list clearfix">::before <div class="data-container">..</div> </div> This xpath gives me error: // [@class=\"data-container\"]" as no such element: Unable to locate element: {"method":"xpath","selector":"// [@class="data-container"]"} 回答1:

How to launch all Karate features setting up which browser to use as an external maven variable

。_饼干妹妹 提交于 2021-02-10 23:17:36
问题 I was trying to find a way to launch all features in Karate testing through maven using an external variable to set up the browser (with a local webdriver or using a Selenium grid). So something like: mvn test -Dbrowser=chrome (or firefox, safari, etc) or using a Selenium grid: mvn test -Dbrowser=chrome (or firefox, safari, etc) -Dgrid="grid url" With Cucumber and Java this was quite simple using a singleton for setting up a global webdriver that was then used in all tests. In this way I

How to click on a button webelement using css_selector with Selenium webdriver for identical button types

血红的双手。 提交于 2021-02-10 22:26:55
问题 For a HTML, <div class="some-class"> <button type="button">Ok</button> <button type="button">Cancel</button> Both button type are the same for two different buttons so how can I click on the Ok button using find_element_by_css_selector? I tried driver.find_element_by_css_selector("div.some-class > button.button[1]").click() but it didn't work for me. 回答1: Use div.some-class > button.button as selector becasue find_element_by_css_selector return the first matched WebElement: driver.find

Selenium div attributes keep changing, how can I find this element?

不想你离开。 提交于 2021-02-10 22:21:47
问题 I am trying to find an element with Selenium and Java, the problem is that the element's id, class, and name always increment so I am not able to find it with selenium. Below is what I am currently trying: WebElement field = driver.findElement(By.xpath("//input[contains(@linkText, 'Broadcast copy')]")); In my html file these are the attributes that keeps changing: id="files[%2Fopt%240%2Frules%2F%2F000102%2.xml][%2Fcluster%2Fname]" name="files[%2Fopt%240%2Frules%2F%2F000102%2.xml][%2Fcluster

Selenium div attributes keep changing, how can I find this element?

心不动则不痛 提交于 2021-02-10 22:21:34
问题 I am trying to find an element with Selenium and Java, the problem is that the element's id, class, and name always increment so I am not able to find it with selenium. Below is what I am currently trying: WebElement field = driver.findElement(By.xpath("//input[contains(@linkText, 'Broadcast copy')]")); In my html file these are the attributes that keeps changing: id="files[%2Fopt%240%2Frules%2F%2F000102%2.xml][%2Fcluster%2Fname]" name="files[%2Fopt%240%2Frules%2F%2F000102%2.xml][%2Fcluster

Python Selenium 4 - Firefox FirefoxBinary() Deprecated

爱⌒轻易说出口 提交于 2021-02-10 21:16:35
问题 I have upgraded to Selenium 4 new_binary_path = FirefoxBinary('path_to_binary') selenium.webdriver.Firefox(executable_path=path, options=ops, firefox_binary=new_binary_path) or options.add_argument("--setBinary(path_to_binary)") selenium.webdriver.Firefox(executable_path=path, options=ops) Return this error message DeprecationWarning: executable_path has been deprecated, please pass in a Service object Documentation https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium

chromedriver.exe runs ~8 chrome.exe instances

懵懂的女人 提交于 2021-02-10 20:28:29
问题 I write UI automation tests using Selenium. And I noticed that when I create an instance of chromedriver.exe -> ~8 chrome.exe processes appear in the Task Manager. Task Manager screenshot when running 1 test: So, when I run in parallel, let's say, 8 tests there are a lot of chrome.exe instances in the Task Manager that use some ports and load a CPU and a memory. Does it work by design? Why so much chrome.exe instances are needed for one chromedriver.exe? Is this configurable? In my code, I