w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Issue with Drag and Drop element in Selenium Web driver with Java
Just use the built in dragAndDrop action to handle this for you: Actions builder = new Actions(driver); builder.dragAndDrop(dragElement, dropElement).perform(); The API documentation is located here, which shows the usage for the dragAndDrop action: http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/interactions/Actions.html

Categories : Selenium

How to access the first element of an array and click the same at runtime using selenium web driver?
From the code you've supplied, you're using an invalid selector for the Options. They don't appear to have a name attribute Aside from modifying the loop, you could make the operation faster if the DOM isnt reconstructed. WebElement selectBox = driver.findElement(By.xpath(Testconfiguration.size_dropdown_10deep)); List<WebElement> options = selectBox.findElements(By.tagName("option")); for ( WebElement option : options ) { selectBox.click(); option.click(); }

Categories : Java

Selenium IDE intermittent error - Element css=a.signout not found
Maybe, just maybe: What happens if you change |click | link=SIGN IN | | to |clickAndWait | link=SIGN IN | | The error could be that the logout link is not yet present when you try to click it, because page did not load completly. But please consider this answer as plain guess, because I do not have much information to build on

Categories : Selenium

Selenium IDE: How to continue script on element not found or on error
The Selenium IDE plug-in is intended more for recording (i.e., showing you the code behind the actions); it does allow some playback, but that's pretty limited and I'm not sure it lets you handle errors. Now if you you're willing to use actual programming, then you can easily handle errors. E.g., in Python you can use something like this: try: driver.find_element_by_id("userid").click() except NoSuchElementException: # do something else (close page, give you a warning, etc)

Categories : Selenium

Selenium web driver error of Uninitialized constant Selenium::Webdriver
Try this out : driver = Selenium::WebDriver.for :firefox source

Categories : Ruby

Selenium Web Driver seems to skip driver.get() intermittently
No problem, change code to something like this instead: Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(30, SECONDS) .pollingEvery(5, SECONDS) .ignoring(NoSuchElementException.class, ElementNotFoundException.class); wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Liferay"))); driver.get(baseUrl + "/user/tm2/so/dashboard"); driver.findElement(By.xpath("//h3[contains(., 'Not Found')]"));

Categories : Java

Selenium Webdriver with Java: Element not found in the cache - perhaps the page has changed since it was looked up
If there has been any changes to the page after you have initially found the element the webdriver reference will now contain a stale reference. As the page has changed, the element will no longer be where webdriver expects it to be. To solve your issue, try finding the element each time you need to use it - writing a small method that you can call as and when is a good idea. import org.openqa.selenium.support.ui.WebDriverWait public void clickAnElementByLinkText(String linkText) { wait.until(ExpectedConditions.presenceOfElementLocated(By.linkText(linkText))); driver.findElement(By.linkText(linkText)).click(); } Then within your code you'd only need to: clickAnElementByLinkText("Logout"); So each time it will find the element and click on it, as such even if the page change

Categories : Java

How to resolve [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
When I copy and paste your code into Eclipse I get the error message you mention. That is because the driver name is malformed. Instead of... String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb,*.accdb)};DBQ="+fn+".accdb;"; ...you need to use... String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+fn+".accdb;"; Note the single spaces in ... Driver (*.mdb, *.accdb)...

Categories : Java

No root element found. Issue?
When I use the following code (in which I added a simple version of the Settings class) on OSX with Xamarin Studio, I get no errors. using System; using System.IO; using System.Xml; using System.Xml.Serialization; namespace Test { class MainClass { private static Settings _instance; public static void Main (string[] args) { Load ("Settings.xml"); } public static void Load(string filename) { if (!File.Exists(filename)) throw new ArgumentException("File not found.", "filename", new FileNotFoundException()); //works var doc = new XmlDocument(); doc.Load(XmlReader.Create(File.OpenRead(filename))); Console.WriteLine(doc.DocumentElement.FirstChild);

Categories : C#

Error creating Session: org.hibernate.HibernateException: Specified JDBC Driver com.mysql.jdbc.Driver class not found
The error message you got from Hibernate Error creating Session: org.hibernate.HibernateException: Specified JDBC Driver com.mysql.jdbc.Driver class not found occurs because the class com.mysql.jdbc.Driver is missing from your classpath, ie. the jar containing it should be in WEB-INF/lib. Add the mysql connector jar to that folder.

Categories : Java

Selenium web driver and multillanguage
Maybe you can change encoding after element.getTex() example String tmp = elem.getText(); String utfString = new String(tmp.getBytes(Charset.forName("utf-8"))); I use java.nio.Charset to set charset; Hope it's help you.

Categories : Java

Specified JDBC Driver com.mysql.jdbc.Driver class not found
Try to add the connector to build path as external jar OR , create a lib folder and put connector jar in it and then Add Library to your build path and give that connector lib folder path.

Categories : Java

Selenium @FindBy vs driver.findElement()
Roughly speaking, @FindBy is just an alternate way of finding elements (the "usual way" being driver.findElement() as you said). The big advantage of that annotation is not itself, though. It is better used to support the PageObject pattern. In a few words, the PageObject pattern tells you to create a class for each page of the system you are trying to use/test. So, instead of having (the usual driver.findElement() code): public class TestClass { public void testSearch() { WebDriver driver = new HtmlUnitDriver(); driver.get("http://www.google.com/"); Element searchBox = driver.findElement(By.name("q")); searchBox.sendKeys("stringToSearch"); searchBox.submit(); // some assertions here } } You'd define a class for the page (with

Categories : Selenium

Selenium and Internet Explorer Driver
Without seeing all that extra information that Arran requested, it's hard to help you understand the error. However if you're just looking for a quick fix that works in all browsers, I always just use Thread.sleep(int milliseconds); for my Selenium tests in C# that need to wait for a page to load or a certain element to render before continuing.

Categories : C#

selenium.getText finds element but selenium.click does not
You are really want to use Selenium 2 (aka Web Driver), it's much more faster and reliable. So forget about Selenium 1 unless you have a really good reason to use it. Your code should look like this WebDriver driver = new FirefoxDriver(); //or any other, like ChromeDriver or OperaDriver WebElement element = driver.findElement(By.id("idOfYourElement"); element.click(); String text = element.getText(); Also see the 5 minute getting started guide

Categories : Java

How to handle multiple frames in selenium web driver?
You can only search within one frame with WebDriver. To interact with element in another frame, you need to "switch" to it. Then the driver will shift its context into that frame and you'll be able to work inside it. with a small piece of code driver.switchTo().frame() methods after you're done, switch back to main window using driver.switchTo().defaultContent(); Also, more documentation.

Categories : Selenium

Selenium::Remote::Driver capture errors
No, that's already how one works with that module. It throws exceptions for every little thing that can go wrong (a design mistake in my book), so you have no other choice but to catch them. Perhaps switch to Try::Tiny if you want syntactic sugar. Since the module errors are untyped strings (another design mistake), you cannot catch specific errors. You have to catch all and parse them.

Categories : Perl

How to handle Flash objects using Selenium Web Driver
Selenium automates Web browsers. From http://seleniumhq.org.. Selenium automates browsers. That's it. Flash objects are impossible to automate using Selenium as flash objects are not technically 'browser driven' like javascript is. You'll have to find other software to automate Flash. Source - I am a contributor / maintainer of the project.

Categories : Selenium

What is the difference in setBrowserUrl() and url() in Selenium 2 web driver for phpunit?
setBrowserUrl() sets a base url, allowing you to use relative paths in your tests. The example from the phpunit manual is kind of confusing - I believe setBrowserUrl() is being used during setup simply because it'll throw an error without it: public function start() { if ($this->browserUrl == NULL) { throw new PHPUnit_Framework_Exception( 'setBrowserUrl() needs to be called before start().' ); } $this->url will use this base if a relative path is given.

Categories : Selenium

Method invoking twice when using TestNG in Selenium Web Driver
Your Countrychoser class extends Baseurl , so it's now a Baseurl too and rightfully has basic() method which is annotated as a test method. Thus, basic() makes into the execution list. So does Choser() method (as expected) that invokes basic() method again, hence basic() runs twice in total. To avoid it you either don't inherit Baseurl or get rid of @Test annotation for basic(). You could probably have a parent class that provides driver (and has no test methods) and inherit it in Base and Countrychoser (these two being siblings).

Categories : Java

Using Selenium Records for Jmeter Web Driver Sampler
Okay I found a way better documentation, no idea why this didn't came up in the search. This Documentation pretty much answers my question.

Categories : Selenium

Can we integrate Sikuli and Selenium Web driver using Ruby
You will have to install sikuli gem and also Sikuli IDE. And then require sikuli gem in the script in which you want to automate using Sikuli. And write sikuli code to automate part you want to automate using Sikuli. require 'selenium-webdriver' require 'sikuli' screen = Sikuli::Screen.new username = screen.click(<path_to_username_text_field_image_file>) screen.type("username") password = screen.click(<path_to_password_text_field_image_file>) screen.type("password") screen.click(<path_to_ok_button_image_file>)

Categories : Ruby

Selenium - Chrome Web Driver - Html Only, No Images
Caching from one session to another is not possible as far as I know. However, it is possible to remove rendering the page if you run it headless. This will load the page, but not render it (make it visible, load images). You can use HTMLUnitDriver, which is the standard, but somewhat outdated, or you can use PhantomDriver, which has a more modern version of Javascript.

Categories : Selenium

Kendo UI grid select row via selenium web driver
okay, I did it in the end like this: IJavaScriptExecutor js = Driver as IJavaScriptExecutor; js.ExecuteScript(String.Format("return $('td:contains("{0}")').parent().addClass('k-state-selected');", matterId));

Categories : Asp Net Mvc

Selenium ie driver cannot switch to window popup
Above code isfor handling window pops. If you want to handle javascript popups like alerts, or confrmation popup, you need to use driver.SwitchTo.alert().accept(); or driver.SwitchTo.alert().dismiss(); hope it'll help you

Categories : Selenium

Selenium Webdriver screenshots do not show driver errors
Maybe because the driver is not with the Alert/Window active? You could try something like this: private void CheckForOtherWindows() { //Check for any other window open if (driver.WindowHandles.Count > 0) { foreach (string window in driver.WindowHandles) { driver.SwitchTo().Window(window); TakeScreenshot(); } } //Check for alert window try { driver.SwitchTo().Alert(); TakeScreenshot(); } catch { //Nothing } } This is not tested, not sure if works. Just giving the idea. :) Edit: To maximize the window is easy: driver.Manage().Window.Maximize(); Hope it helps.

Categories : Java

Problems with loading chrome browser using selenium web driver
Do not use your Chrome binary that you browse the internet with. Download it from the Chromedriver website, and specify the path to that in your code. This link has the solution explained in more detail: http://www.gjdb.nl/?p=214: When you want to run Chrome on WebDriver for your Mac, then according to according to the site http://code.google.com/p/selenium/wiki/ChromeDriver you will need to specify the path to the browser to the following location: “/Applications/Google Chrome.app/Contents/MacOS/Google Chrome”. So the Java code for creating a ChromeDriver instance will be: System.setProperty("webdriver.chrome.driver", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"); driver = new ChromeDriver(); When trying to run this I got the following exception.

Categories : Java

how to select a value in drop down randomly using xml in selenium web driver with Java
In your java/selenium test script Get test data array length Generate a random number in the range 0-LengthOfArray-1 (Generate Random Number in a given Range) Use the above number to select a country from test data array

Categories : Java

Selenium: do javascript actions reflect in driver.page_source?
No, driver.page_source only gives static html code. If you want html created by js, you may use driver.execute_script() It runs js script and returns the result. Here is an example: element = driver.find_element_by_xpath("//div[@class='WB_feed_type SW_fun S_line2']") #which is created by js wbHTML = driver.execute_script("return arguments[0].innerHTML;", element)

Categories : Javascript

Selenium sendkeys drops character with Chrome Driver
Investigating you are from Czech Republic also, I am going to make wild assumption, that your keyboard is set up to Czech as default. I also had some strange issues with sendKeys when my system had Czech keyboard as default one. Since I changed default to English, the problems dissapeared. If this does not help, please provide info what is going to happen if you try this: name.sendKeys("2"); name.sendKeys("22222222"); name.sendKeys("4"); name.sendKeys("44444444"); name.sendKeys("424242");

Categories : Java

Selecting an item from a combo box selenium driver with java
In WebDriver there is separate Class (Select) is there to deal with Combo lists. Use below logic to select options from pick list fields Select select=new Select(driver.findElement(By.xpath("//div[@id='views/div/select']")); select.selectByVisibleText("NIC"); or select.selectByIndex(0); or select.selectByValue("value"); Refer this post for more info regarding Select class.

Categories : Java

how to over come ssl certifcate error for selenium web driver in Internet Explorer
I dont' think there is a way to properly set it. CapabilityType.ACCEPT_SSL_CERTS won't work for IE I suppose, Selenium is designed to ignore the invalid capability for the particular browser and won't throw an exception. Here is a workaround you can click link "Continue to this website (not recommended)." to bypass it. Try // check if your driver is IEDriver and driver's Title contains "Certificate" // then driver.navigate().to("javascript:document.getElementById('overridelink').click()"); driver.findElement(By.name("username")).sendKeys("Admin1"); driver.findElement(By.name("password")).sendKeys("Password2");

Categories : Java

python's selenium "send_keys" with chrome driver drops characters
Use selenium Ide and export test case in python from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException import unittest, time, re class Test1(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "https://www.facebook.com/" self.verificationErrors = [] self.accept_next_alert = True def test_1(self): driver = self.driver driver.get(self.base_url + "/") driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("username") driver.find_element_by_id("pass").clear() driver.fin

Categories : Python

Selenium chrome driver click() method not always clicking on elements
I can't explain why the selenium driver .click() method won't fire on some elements in the page but not others, but I did find a solution. Using IJavaScriptExecutor you can click the element using javascript instead and in my case it worked. Here is the code to run the IJavaScriptExecutor and below is my whole method. //IJavaScriptExecutor IJavaScriptExecutor js = _driver as IJavaScriptExecutor; js.ExecuteScript("arguments[0].click();", infoButton); //my whole method for clicking the button and returning the page object public ShippingMethodDetailsPageObject SelectShippingMethodInfo() { _driver.SwitchTo().Frame(_frameElement); _wait.Until(d => { var shippingInfoButton = d.FindElement(By.CssSelector("input[title='Info']

Categories : C#

How to get the value from tag using java in Selenium web driver when the Value attribute is generated dynamically
Code should be something like this WebElement dropDown = driver.findElement(By.id("GlobalDateTimeText")); Select sel = new Select(dropDown); List<WebElement> values = sel.getOptions(); for(int i = 0; i < values.size(); i++) { System.out.println(values.get(i).getText()); }

Categories : Selenium

Unable to upload a system file using AutoIt in Selenium web driver
Instead of using AutoIt to handle a file upload.. simply use IWebElement.SendKeys on the file input element, and the file upload dialog will be handled automatically for you. So, instead of clicking on the file browser button... Find the input element on the page where <input type="file"/>, and then create then create the appropriate locator to retrieve the element. Then, use IWebElement.SendKeys() to this element with the full path of the file you want to upload.

Categories : Selenium

How do I return the text of a WebElement using Perl's Selenium::Remote::Driver?
Following up on our comment thread, I'm posting this as an answer: Selenium::Remote::WebDriver definitely has a method named find_element(), and Selenium::Remote::WebElement definitely has a method named get_text(). Something like this... my $text = $sel->find_element(...)->get_text(); ...works fine on my end, though it looks like it'll error out if the element isn't found.

Categories : Perl

Selenium: chrome driver makes screenshot just of visible part of page
This is a known bug: https://code.google.com/p/chromedriver/issues/detail?id=294 (Only for Chrome driver, firefox driver works fine)

Categories : Selenium

Driver behavior executing parallel TestNG selenium tests with dataprovider
I had the same experience about dataProvider. In my case I used dataProvider's (parallel=true) attribute though. There are two solutions to your problem. Use dataProvider and in test class and use factory annotation for your constructor. In the factory annotation's attribute, use dataProvider="Your dataProvider's name". In the testng.xml, instead of parallel=methods, use parallel=instances. The drawback of the above approach is that when you get the report; may be it is maven- surefire, testng Eclipse report or reportNG report, you do not see parameters passed up front. To overcome this, you can use the following approach. Create a factory class and instantiate your test class in the factory method using a for loop. (Start for loop from 0.) In the test class define a constructor whi

Categories : Selenium

Why does the Selenium Firefox Driver consider my modal not displayed when the parent has overflow:hidden?
According to the Selenium WebDriver source code, an element must not have overflow: hidden as a style. (ref) (UPDATE I just realized that the maintainers have updated the code in the ref I linked to, but that the original 2.33 code did include the overflow: hidden check. Its just been refactored for presumable 2.34.) So, it looks like unless the maintainers decide against this, you are SOL. But the first step to getting the maintainers to notice the issue is to add an Issue to the official repository, which it looks like you have done. One possible solution in the meantime if you can't get you developers to help you is to use Javascript to remove the overflow attribute: driver.executeScript("arguments[0].setAttribute('style', 'overflow: none;')", page_content_element) And try to run

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.