selenium-webdriver

Python Selenium `move_by_offset` doesn't work

ε祈祈猫儿з 提交于 2020-01-24 06:28:51
问题 Calling simple scrolling action with Python Selenium doesn't work : driver = webdriver.Chrome() driver.get('https://www.wikipedia.org/') time.sleep(2) actions = ActionChains(driver) actions.move_by_offset(500, 500).perform() For example function with moving to element, works Ok and Do scroll: driver = webdriver.Chrome() driver.get('https://www.wikipedia.org/') time.sleep(2) element = driver.find_element_by_css_selector(<Something>) actions = ActionChains(driver) actions.move_to_element

Running Selenium tests with Xamarin Studion on MAC

南笙酒味 提交于 2020-01-24 06:21:11
问题 I am trying to run my created tests on Visual Studio 2010 , using Selenium WebDriver , in a MAC using Xamarin Studio. I have chromedriver.exe as EmbeddedResource, so I removed and add the one for mac (chromedriver). Everything looks okay but doesnt allow me to run them because I see this error: OpenQA.Selenium.WebDriverException : Unexpected error. System.Net.WebException: Error: ConnectFailure (Connection refused) ---> System.Net.Sockets.SocketException: Connection refused at System.Net

TestNG Reporter org.testng.reporters.JUnitReportReporter@7a79be86 failed java.util.ConcurrentModificationException

只愿长相守 提交于 2020-01-24 04:23:11
问题 I'm new to TestNG framework, I have written script for an application using TestNG framework. Script working fine but yet I'm getting an error at the end of console. Error attached. Please anyone can help me. Thanks in advance.enter image description here 回答1: Edit: Fixed in 6.10 It is a known issue in the latest release (6.9.13.x) and will be fixed in the next release: https://github.com/cbeust/testng/issues/1168 Issue also appears while I'm testing with release - 6.8. 回答2: I already had

WebDriverWait does not ignore exceptions

血红的双手。 提交于 2020-01-24 03:16:29
问题 I am using the most current Chrome and Webdriver 2.33 and am having some issues with IgnoreExceptionTypes . In the below code webdriver will wait like I expect it too but it will not actually ignore the exceptions: WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(8)); wait.IgnoreExceptionTypes( typeof(WebDriverTimeoutException), typeof(NoSuchElementException) ); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(firstResultX))); The code is in a try/catch, I tried

How to find Broken Links using Robot Framework

空扰寡人 提交于 2020-01-24 01:59:33
问题 I'm facing an issue with finding the broken links on the webpage. I'm using RequestsLibrary for the same. Right now I'm able to find all the links but now able to verify them against the response code. Get All Link Tests [Tags] Regression [Setup] Log To Console Test for total links present on landing page started... ${base_url}= Get Base Url open browser about:blank ${browser} go to ${base_url} ${ALL_LINKS_COUNT} get element count xpath://a log to console ${ALL_LINKS_COUNT} @{LINK_ITEMS}

How to take a screenshot for Soft Assert in Selenium or Java

安稳与你 提交于 2020-01-24 01:57:14
问题 Iam trying to take a screenshot for a testcase which fails using soft Assertion.I am using softAssertion for when a particular step fails it shows the failed step in the report but continues the execution.So in such case how can I take a screenshot whenever the tescase fails in soft Assert..plz help ? 回答1: In the catch block of executeAssert either call a method that takes screenshot or implement the code there. @Override public void executeAssert(IAssert a) { try { a.doAssert(); } catch

selenium webdriver does not find the correct number of elements

落花浮王杯 提交于 2020-01-24 01:08:06
问题 Initially, I posted my question here: Extracting content from a dynamic web site using a Java Library Then, after reading and applying the info from the question below: Selenium Webdriver : not displaying the correct Li elements I installed a selenium chrome driver (Version ChromeDriver 74.0.3729.6), my chrome browser has version 74.0.3729.169. The selenium WebDriver java object is still unable to correctly find the number of elements on my web-page, altough I simulated a scroll-down and the

Selenium clearing and typing in text into textarea text box [Python]

拈花ヽ惹草 提交于 2020-01-24 00:35:14
问题 I am using Selenium to do some scraping. I used the following code to input the text into a textarea text box: def clear_and_send_key_then_wait(element, key, sleep_time = 1): # For some reason this does not work # element.clear() # This works element.send_keys(Keys.CONTROL + "a"); element.send_keys(Keys.DELETE); # Input text element.send_keys(key) time.sleep(sleep_time) target_textbox = driver.find_element_by_xpath( """/html/body/div[2]/div/div[2]/div[1]/div[4]/div[1]/div/textarea""") clear

Selenium: horizontal scroll using Actions class

柔情痞子 提交于 2020-01-23 20:47:29
问题 I have tried various to access this custom scroll bar on my web page through Selenium actions as well as Javascript Executor. The scroll bar scrolls through only 500 pixels when in fact I want it to scroll throughout the complete width. Any help is appreciated. Below is my current code snippet: WebElement slider = element("slider_div"); WebElement scrollbar = element("scrollbar"); int w = slider.getSize().getWidth(); Actions move = new Actions(driver); move.dragAndDropBy(e, offset, 0).build()

Can any one explain Screenshot in Selenium?

☆樱花仙子☆ 提交于 2020-01-23 05:37:04
问题 WebDriver driver = new FirefoxDriver(); driver.get("http://www.google.com/"); File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); // Now you can do whatever you need to do with it, for example copy somewhere FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png")); Can any tell me that File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE) getScreenShotAs is the method in the TakesScreenshot Interface...... (TakesScreenshot)driver , What it