Tag Info

New answers tagged

0

As I read your question I have found this scenario while I am practicing automation. <div class = 'abc' id='*dynamic*'> <div class = 'pqr'>date1</div> </div> <div class = 'abc' id='*dynamic*'> <div class = 'pqr'>date2</div> </div> -Here you need to understand that you have all div as same structure. ...


0

If the elements are completely equal (in terms of nodes and attributes), one way to tell them apart is with the Xpath predicate last() or simply call the n-th element with [n]. For example, if you know the second calendar is added below the first, you can use either of the above, depending on your test. See also ...


1

Please use below xml file and from command prompt go to project location and run as "ant generateReport" (Should have ANT). Let me know if you have any questions. .xml file: <project name="TestAutomation" basedir="."> <property name="LIB" value="${basedir}/lib" /> <property name="BIN" value="${basedir}/bin" /> <path ...


0

The solution I would use is the WebDriver's driver.switchTo().frame() method but avoiding the index number. You can select the window you want using; A number. (0 based index normally but NOT always with IE) A name or ID. A previously found WebElement. an example driver.switchTo().frame(driver.findElement(By.id("Head1")));


0

File file = new File("G:\\Selenium\\All_Jars\\chromedriver.exe"); System.setProperty("webdriver.chrome.driver",file.getAbsolutePath() ); driver = new ChromeDriver(); //Maximize the window driver.manage().window().maximize(); driver.get("http://www.rediff.com/"); //Get all window handles Set<String> allHandles = driver.getWindowHandles(); ...


0

Have you checked to see if it's a possible timing issue? Seems dumb but response times between browsers can sometimes give odd results like this.


2

Setting up Selenium tests to run on Safari browser is a fairly complex process. You need to install Safari Extensions Developer Certificate in your machine and also install selenium webdriver as an extension in Safari Browser. Also there are some stability issues with Safari browser automation & Selenium combination on Mac 10.9 OS and below. The ...


0

IE driver is sometime difficult(and frustrating) to make work when things are running properly on chrome and firefox. For your specific example, I have had issues with window order in the IE driver in the past. So the number of windows that you have open may not correspond to what window you actually are trying to access. You have to write your own handler ...


0

The problem could be that the page in the new window is still loading while you are trying to interact with it, so you might need to add in a wait condition. When I've done this, I've added in waits to make sure that the new window has actually been opened, and then to make sure the page in the new window is loaded. from selenium.webdriver.support.wait ...


0

Try either: driver.find_element_by_xpath(u'//a[text()="Foo text"]') or dedicated driver method: driver.find_element_by_link_text("Foo text") Add .click() if needed. For troubleshooting, check this post at SO, as maybe your page isn't loaded yet, so you probably need to write a wait wrapper to wait for an element to appear.


0

You can't interact with the native OS file browser dialog directly, but we do some magic so that if you call WebElement#sendKeys("/path/to/file") on a file upload element, it does the right thing. Make sure you don't WebElement#click() the file upload element, or the browser will probably hang. Source - Selenium WebDriver Wiki. Protractor uses ...


3

List cheeses = driver.findElements(By.className("cheese")); findElements() does not wait, but returns list of elements (located by locator). List is empty if nothing is found. http://docs.seleniumhq.org/docs/03_webdriver.jsp


1

Check this code. It works properly in IE. All you need to set some capabilities. DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer(); ieCapabilities.setCapability("nativeEvents", false); ieCapabilities.setCapability("unexpectedAlertBehaviour", "accept"); ieCapabilities.setCapability("ignoreProtectedModeSettings", true); ...


2

Selenium 2 (webdriver) is designed to do exactly what you need. It allows you to simulate whatever real users can do with a browser: log to a website, click on buttons, fetch content of HTML elements, and analyze the text using any tools necessary. You can use different kinds of locators to identify HTML elements to process (ID, name, CSS class, link text ...


2

You can use Selenium Webdriver to automate this task. It can read the DOM of the HTML, and extract information from it; it controls a browser the same way you do, so anything you can do manually it can do (with a few exceptions). I would suggest looking into that rather than taking screenshots and parsing them as PDFs.


1

This line: password = slogin.passwordField1; Is a simple assignment. It's not the line that throws the exception. PageFactory will attempt to lazy-initialize the field when it is used, not just referenced; I'm not 100% clear on whether assignment is considered a use, but it's very likely that it's the return statement that's throwing instead. For this use ...


0

WebDriver driver; driver.quit(); Above will close all open browser windwos. And WebDriver driver; driver.close(); This will close current browser window in focus.


0

In Selenium features the server and client are running in separate processes. Therefore when mocking time with a tool like Timecop, the browser controlled by Selenium will still see the unmocked system time. Simple case: Synchronizing the client’s time with the mocked server’s time = render "layouts/sinon" # the card attached partial Advanced case ...


-1

When we look at the try and catch we can see that we normally use catch (Exception e); but in the case of Webdriver we will have to use catch (Throwable e). So try to use this: public WebElement getPasswordField() { SmallLoginLocators slogin = PageFactory.initElements(wd, SmallLoginLocators.class); WebElement password; try { password ...


0

NPE exception comes while some situations are there.Please first avoid this situations. 1) Your browser should be open in screen. You can not minimize while taking screenshot. It is limitation of that. Screenshot captures opened/window display only. 2) Remove turn off display option from sleep mode. While you turn off display you get surely NPE. Because ...


0

It's only difficult until you learn how to program. :) If you're already using Java and Selenium then you know how to program. You will have to learn how the code you're testing works and you will need to learn how to write unit tests. tl;dr you can do it.


2

Your screenshot function is creating a new WebDriver instance each time and then taking a screenshot of the default blank page in firefox. You could try passing in your test's WebDriver instance so you get a picture from your test: static public void screenShotOnError(WebDriver driver) { long epoch = System.currentTimeMillis(); String ssTimestamp = ...


-1

this code work for me driver.manage().deleteAllCookies(); // Clear Cookies on the browser driver.close(); // Close a single browser window ProfilesIni firProfiles = new ProfilesIni(); FirefoxProfile wbdrverprofile = firProfiles.getProfile("default"); driver = new ...


0

1) driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); This means that we can tell Selenium that we would like it to wait for a certain amount of time before throwing an exception that it cannot find the element on the page. We should note that implicit waits will be in place for the entire time the browser is open. This means that any search ...


0

Actually 'throws exceptions' is the only way to get error. If error comes from your setup or dependency it will not shown If you remove throws statement. If you are not confident about which exception is coming then write 'throws Exception'. It will throw all exception by default. Now come to your question. Your code perfectly fine working. Just check ...


3

This error means that you have forgotten to include a dependency in your project. It's been suggested on stackoverflow that the dependency you forgot might well be selenium-server-standalone-version.jar. Does adding that jar to your project help?


0

It doesn't sound as if you need to use Selenium to download the file, just for the browser session. If that is the case, how about instead of downloading the file through the web browser, you pass the browser's session information over to an HTTP library and request the file to be downloaded? For a specific example, in Python, I would find the URL I am ...


0

As an alternative to the answer I accepted above, I'm now using the following code when I need to do this: var dropdown = Driver.FindElement(element); var optionList = new List<string>(); optionList = dropdown.Text.Split(new[] { "\r\n" }, StringSplitOptions.None).ToList(); Now I can search within the list for a string to see if it is present in the ...


-1

I used Java Thread and Robot with Selenium to automate windows active directory authentication. You may refer to my response here Windows Authentication using Selenium and Java Thread.


0

If you just want to send the file to the webserver, you can do it with a headless http client, for example using the mechanize library in Ruby or Perl, or the the Request library in Python. You don't need to do everything from the browser.



Top 50 recent answers are included