webdriver

Spring SimpleThreadScope does not support descruction callbacks

不羁岁月 提交于 2021-01-28 04:02:19
问题 I would like to run parallel selenium tests (using webriver and the Spring JUnit runner). Webdriver is a spring bean with the custom thread scope. But I get a following warning SimpleThreadScope does not support descruction callbacks So the browsers are not closed. Any idea how to close them (more precisely call the quit method)? spring config <bean id="threadScope" class="org.springframework.context.support.SimpleThreadScope" /> <bean class="org.springframework.beans.factory.config

How to extract the text of the firstselectedoption from a dropdown using Selenium Webdriver through Java

半城伤御伤魂 提交于 2021-01-27 22:10:50
问题 After selecting an option from drop-down. I am trying to get that option displayed in the console. below is my code. But I get "//[[[[ChromeDriver: chrome on WINDOWS (d5a01776981da5dacfeb89dbbc2e6b52)] -> xpath: //*[@name='airline']]].// -> tag name: option]" The tag name is option for dropdown options. I have tried all solutions of selectByXXXX. but nothing seems to work. what would be the right code ? //airline preference { Select airline = new Select (driver.find Element(By.name("airline")

SyntaxError: invalid syntax while using find_element_by_xpath using Selenium in Python

余生颓废 提交于 2021-01-27 18:53:27
问题 Code Trials: from selenium import webdriver driver = webdriver.Firefox() driver.get("http://www.niftyindices.com/reports/historical-data") driver.maximize_window() driver.find_element_by_xpath("//*[@id="ddlHistorical"]").send_keys("NIFTY 100") I am getting an error: File "<ipython-input-32-592f058980cd>", line 5 driver.find_element_by_xpath("//*[@id="ddlHistorical"]").send_keys("NIFTY 100") ^ SyntaxError: invalid syntax 回答1: This error message... SyntaxError: invalid syntax ...implies that

How to verify dimensions of image in Selenium Java Webdriver?

一曲冷凌霜 提交于 2021-01-27 17:45:58
问题 I want to verify the first image on my page is a certain dimension. I have the code I'm using right now to GET the dimensions, but now, I need to verify that the image is 1024 pixels wide... How do I do this? Dimension elementDimensions=(Insert Element Here).get(0).getSize(); elementDimensions.getHeight(); elementDimensions.getWidth(); Assert.assertTrue......... 回答1: I think you already getting width and height from driver and known what would be the expected value. So you can use Assertions

What is the correct syntax checking the .readyState of a website in Selenium Python?

六眼飞鱼酱① 提交于 2021-01-27 12:19:03
问题 I'm trying to check the .readyState of a website using .execute_script but I keep getting an error. I'm using a pageLoadStrategy of "none" in chromedriver so I'm trying to test that the websites readystate is no longer "loading". Note: this question is Python-specific. WebDriverWait(driver, timeout=20).until( driver.execute_script('return document.readyState') == 'interactive' ) value = method(self._driver) TypeError: 'str' object is not callable I've also tried using lambda which doesn't

What is the correct syntax checking the .readyState of a website in Selenium Python?

扶醉桌前 提交于 2021-01-27 12:16:00
问题 I'm trying to check the .readyState of a website using .execute_script but I keep getting an error. I'm using a pageLoadStrategy of "none" in chromedriver so I'm trying to test that the websites readystate is no longer "loading". Note: this question is Python-specific. WebDriverWait(driver, timeout=20).until( driver.execute_script('return document.readyState') == 'interactive' ) value = method(self._driver) TypeError: 'str' object is not callable I've also tried using lambda which doesn't

System.InvalidOperationException : Unable to create new service: ChromeDriverService with ChromeDriver and SeleniumGrid on local machine

泄露秘密 提交于 2021-01-27 08:54:19
问题 I had set up Selenium Grid (Both Hub and Node) on my local machine which runs on Windows 10 using below command for registering Hub. java -jar selenium-server-standalone-3.141.59.jar -role hub and for registering a Node, I had used below command java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://10.37.34.2:4444/grid/register -port 5454 On Command Prompt, it displayed that "The node is registered to the hub and ready to use" Verified Grid Console as well at http:/

System.InvalidOperationException : Unable to create new service: ChromeDriverService with ChromeDriver and SeleniumGrid on local machine

我的梦境 提交于 2021-01-27 08:53:02
问题 I had set up Selenium Grid (Both Hub and Node) on my local machine which runs on Windows 10 using below command for registering Hub. java -jar selenium-server-standalone-3.141.59.jar -role hub and for registering a Node, I had used below command java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://10.37.34.2:4444/grid/register -port 5454 On Command Prompt, it displayed that "The node is registered to the hub and ready to use" Verified Grid Console as well at http:/

How to stop protractor from downloading latest chromedriver?

杀马特。学长 韩版系。学妹 提交于 2021-01-27 05:54:28
问题 I am running E2E tests using Protractor on Bamboo. I got this error unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) Then I found that I had to downgrade to 2.37 version of Chromedriver. I found that here "https://github.com/angular/protractor/issues/4850" . I found a way to download a specific version of chromedriver here https://medium.com/@cnishina/webdriver-manager-a-node-module-c33a820f5eb . So I am using webdriver-manager

How to stop protractor from downloading latest chromedriver?

青春壹個敷衍的年華 提交于 2021-01-27 05:54:06
问题 I am running E2E tests using Protractor on Bamboo. I got this error unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) Then I found that I had to downgrade to 2.37 version of Chromedriver. I found that here "https://github.com/angular/protractor/issues/4850" . I found a way to download a specific version of chromedriver here https://medium.com/@cnishina/webdriver-manager-a-node-module-c33a820f5eb . So I am using webdriver-manager