selenium-webdriver

ChromeDriver does not start through CMD with “testng.xml”

左心房为你撑大大i 提交于 2020-02-25 09:00:19
问题 I was trying to run a TestNG.xml file from CMD but there are no errors shown and it seems that ChromeDriver is not starting. Note : if i go to Eclipse -> right click on testng.xml -> run as TestNG suite it will work perfectly. Below is the message i get when executing through cmd. The bat file contains: java -cp "D:\Java Applications\WebDriverProject\lib*;D:\Java Applications\WebDriverProject\bin" org.testng.TestNG testng.xml pause The testng.xml contains: The project structure from eclipse

ChromeDriver does not start through CMD with “testng.xml”

允我心安 提交于 2020-02-25 08:59:05
问题 I was trying to run a TestNG.xml file from CMD but there are no errors shown and it seems that ChromeDriver is not starting. Note : if i go to Eclipse -> right click on testng.xml -> run as TestNG suite it will work perfectly. Below is the message i get when executing through cmd. The bat file contains: java -cp "D:\Java Applications\WebDriverProject\lib*;D:\Java Applications\WebDriverProject\bin" org.testng.TestNG testng.xml pause The testng.xml contains: The project structure from eclipse

ChromeDriver does not start through CMD with “testng.xml”

…衆ロ難τιáo~ 提交于 2020-02-25 08:57:50
问题 I was trying to run a TestNG.xml file from CMD but there are no errors shown and it seems that ChromeDriver is not starting. Note : if i go to Eclipse -> right click on testng.xml -> run as TestNG suite it will work perfectly. Below is the message i get when executing through cmd. The bat file contains: java -cp "D:\Java Applications\WebDriverProject\lib*;D:\Java Applications\WebDriverProject\bin" org.testng.TestNG testng.xml pause The testng.xml contains: The project structure from eclipse

Why do some elements exist but not interactable/displayed?

血红的双手。 提交于 2020-02-25 08:30:34
问题 I'm pretty new to testing, trying to gain a better understanding of what exactly is going on. I'm finding some of our test codes are failing when the css selector element has a waitUntilCanInteract or waitUntilDisplayed attached to it even though when I do a chrome inspect the element is showing up in the browser. Changing them to a waitUntilExists gets them to a passing point so I was wondering what exactly is going on to create this situation? 回答1: Precisesly Selenium deals with three

Selenium python unable to scroll down

老子叫甜甜 提交于 2020-02-24 11:49:29
问题 Trying to scroll down to the bottom of the page with selenium-webdriver python so that more products load. driver = webdriver.Firefox() driver.get('https://www.woolworths.com.au/Shop/Browse/back-to-school/free-school-labels') driver.implicitly_wait(100) driver.execute_script("window.scrollTo(0, document.body.scrollHeight);") time.sleep(100) driver.quit() The webpage loads but doesn't change. Am I missing something? 回答1: You can try these move_up and move_down function: driver.maximize_window(

Timeout expired waiting for async script on IE 9

雨燕双飞 提交于 2020-02-24 05:49:08
问题 I'm trying to run some tests (using Protractor) on Internet Explorer 9 - and each test that contains " driver.executeScript " gives an error : Timeout expired waiting for async script (WARNING: The server did not provide any stacktrace information). The other tests work very well. It seems that IE doesn't understand the timeout limit that I add at the end of function (20000 ms) - Timeout expires after ~11 seconds. Is there any WebdriverJS code line to make it wait for async execution? All

How to Wait for an Alert in Selenium WebDriver with C#?

无人久伴 提交于 2020-02-23 08:26:25
问题 How can i set Selenium WebDriver to Wait for an Alert before accepting it instead of Thread.Sleep? As website, sometimes loads very slowly or sometimes fast. Thanks 回答1: You should apply webdriver wait for an alert to be present properly. new WebDriverWait(driver, TimeSpan.FromSeconds(15)); wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.AlertIsPresent()); OR write a boolean function to check alert present and use it for wait bool IsAlertShown(WebDriver driver) { try { driver

Selenium / Raspberry Pi 3 - Unable to find a matching set of capabilities

北战南征 提交于 2020-02-23 07:49:05
问题 I want to run a Python 3 script on my Raspberry Pi and do stuff with it. The script works just fine on my Mac, however I want it to run 24/7 and the Pi is more energy efficient. Not to mention I need my Mac for other things. from selenium import webdriver from selenium.webdriver.common.keys import Keys browser = webdriver.Firefox() browser.get('www.website.com') I am running Raspbian Jesse and have installed Iceweasel (installed today through command line, V 45) and geckodriver (0.18.0).

Webdriver(Selenium2) - How to make selenium operate elements without wating for connecting to external AD links?

≡放荡痞女 提交于 2020-02-22 15:55:07
问题 Environment: - Selenium 2.39 Standalone Server - PHP 5.4.11 - PHPUnit 3.7.28 - Chrome V31 & ChromeDriver v2.7 I'm testing a website,which invokes a lot of Advertisement Systems,such as Google AD. The browser takes a lot of time to connect to external AD links , even all the elements of the page has already been loaded. If my internet network was not fast when I ran my tests on a webpage, Selenium would wait for a very long time ,since the AD links responsed slowly. Under this condition

Create screenshot only on test failure

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-22 08:41:55
问题 Currently I have a function that creates a screenshot and I call it here def tearDown(self): self.save_screenshot() self.driver.quit() There is also a folder being created which is used to store the screenshots. I don't want this to happen when the test passes. What do I have to add in order for this not to happen? Thanks for all the help 回答1: Here is one way to capture screenshot only when failure: def setUp(self): # Assume test will fail self.test_failed = True def tearDown(self): if self