6

We generally do it this way because usually we want to be able to run our tests on multiple browsers. If we declare the driver as a specific driver type, we are then anchored to only that driver. This is not a problem if you only ever need to test on say Chrome for example. But what if you later want your tests to also be able to work with IE, Opera, ...


5

You can find the field and get the maxlength attribute max_length=find('input#id').getAttribute('maxlength') In the IDE I think it would be something like this to store it in 'x': <td>storeAttribute</td> <td>//input[@id='identifier']@maxlength</td> <td>x</td> although I would use css for the identifier, more like: ...


5

GeckoDriver: A Proxy for using W3C WebDriver-compatible clients to interact with Gecko-based browsers. Geckodriver provides HTTP API described by the WebDriver protocol to communicate with Gecko browsers, such as Firefox version above 47. Marionette: Marionette (the next generation of FirefoxDriver) is turned on by default from Selenium 3. Even if you ...


4

Absolutely right, Good explanation provided by @Bill Hileman, I was already upvoted it. In addition to clear this doubt you need to understand What is WebDriver and ChromeDriver/Firefoxdriver. ChromeDriver driver= new ChromeDriver(); With the use of above line, The script works perfectly on chrome browser but things are getting complicated in future if I ...


3

Unfortunatelly I found only workaround solution (e.g. if you need several different Firefox versions on a single station): nodeConfig_1.json { "capabilities": [ { "browserName": "firefox", "version": "51", "platform": "WINDOWS", "maxInstances": 1, "marionette":true, "cleanSession": true }, ... gridNode_1.cmd ...


3

Coming to your first question- How to resolve exception while launching firefox in remotewebdriver: First thing what I observed that- You have to change your code in Setup; as you are using remotewebdriver on remote machines. To run tests on remote machines, WebDriver has to use the instance of the RemoteWebDriver and DesiredCapabilities in order to ...


3

There are no ways to check if you have logged in successfully other than the real users would use. If you log in successfully then you should see some elements that the guest would not see (e.g. the user name in the corner of the screen, or some welcome message, etc.) If you failed to log in you should observe either error message or the style of some input ...


3

Selenium recently launched its one of the major release, i.e., Selenium 3 – beta. You can download it from here- Download Selenium 3.0-Beta . In this new version, one of the major change is the way Mozilla Firefox Browser is invoked and for that GeckoDriver is necessary for invoking Firefox Browser. Gecko Driver can be downloaded from Here. The minimum ...


3

Good question, everyone should aware of the new updates and features in Selenium 3. As of my experience Selenium 3 has lots changes made in configuration/setup level. Even though we have to use GekoDriver for launching Firefox driver. There is also some browser compatibility restrictions are applied in Selenium 3 like Firefox min version must be 48. For ...


3

Unfortunately, it's not possible to send arguments to annotation (reference) One possible solution would be to create a Page Object class for link and pass a WebElement based on its li node. Class Footer { @FindBy(css = "footer") WebElement baseElement; List<WebElement> links; Footer() { this.links = this.createLinks(); ...


2

The syntax for setProperty() method is: System.setProperty("<driver we want to use in the program>", "<path where the driver exists>"); As per the question, In java you have mentioned correctly. In TestNG, in place of 'driver to be used' you have mentioned 'driver path' and in place of 'driver path' you have pointed to ...


2

Different scenarios: 1) maxlength attribute In HTML you might have a maxlength attribute on your input tag. In this case you can extract the value with Selenium's GetAttribute("maxlength") or similar. 2) No maxlength attribute In this case, the validation (if any) is either server-side or client-side (Javascript). Server-side code is impossible to see (...


2

The most reliable method I've found is to configure the VMs to auto-logon with an administrator-level login and disable screensaver and user access control. This effectively means that whenever the vm is on, it is logged on and there is a desktop session running. You may need to convince your employer's network management people to let you do this for the ...


2

You shouldn't use while loops to provide test data to your tests if you use some dedicated test frameworks like TestNg. Instead you should use the mechanisms provided by such frameworks. For TestNg you can provide test data either through xml file or though a special method providing test data for each run. Details: http://testng.org/doc/documentation-main....


2

Have you updated chrome driver as well? – Alexey R. Oct 30 '18 at 16:13 Resolved ! Upgrading to Chromedriver 2.43 did the trick. Latest Release: ChromeDriver 2.43 Supports Chrome v69-71 Changes include: [...] Fixed Switch to Frame is not spec compliant [...] Thanks to Alexey R.


2

Like a lot of things in life, it depends. Both options you lay out will work for test automation. However, what is your overall goal? Are you testing a feature that is on one page? If so, you can load that page directly and test that feature. This is what you listed as option 1. Are you testing a feature integration point, like a page redirect? Are you ...


2

Try using JavaScriptExecutor C# IWebElement element = driver.FindElement(By.XPath("//button[@role='button']")); IJavaScriptExecutor jse2 = (IJavaScriptExecutor)driver; jse2.ExecuteScript("arguments[0].click()", element); Python element = driver.find_element_by_xpath("//button[@role='button']") driver.execute_script("arguments[0].click();", element)


1

I was able to perform drag and drop using the following snippet: _js.executeScript("$(arguments[0]).simulate('drag-n-drop',{dragTarget:arguments[1],interpolation:{stepWidth:100,stepDelay:50}});", _sourceElement, _targetElement); You can read more and download the necessary JS files from this link.


1

Some of the approaches you could use: Ensure that: The login form is not present The 'login' link no longer appears The error message is not displayed Logged in text such as username: appears Links only available to logged in users are present Content only available to logged in users is present There are basically 4 categories: Not logged in should see ...


1

FluentWait: According to your code snippet, it will wait for the expected web element upto 30 seconds. And it will check the condition (or in simple words, look for the element) every 5 seconds within the 30 seconds time limit. You can use FluentWait when your web element appears or loads between some time interval. WebDriverWait: The WebDeiverWait code ...


1

This appears to be an issue with the driver losing track of the click on the note as soon as the click on the image occurs. This is pretty common with some types of dropdowns, but applies in other situations as well. The solution is to wrap the entire set of actions as Actions: // note from toolbar element WebElement toolbarNoteElement = driver.findElement(...


1

Moving Selenium 2 to selenium 3.0.1 is bit easy take less effort Code Changes One of the biggest change is that the old Selenium Core libraries will be dropped in 3.0. The focus will shift completely to the WebDriver API. For the last six years it has been advised to switch to the newer WebDriver APIs and to stop using the original RC APIs. With ...


1

I would just let Selenium find the first img element - no need to do it via XPath manually: IWebElement firstImage = driver.FindElement(By.TagName("img")); Or, if you want to do it in the scope of the desired a element: IWebElement firstImage = driver.FindElement(By.CssSelector("a._1UoZlX img"));


1

This will get you the first result's img element: (//a[@class='_1UoZlX']//img)[1] Honestly though, this is a rat's nest from hell. If I were you I'd have a serious discussion with the developers about getting some tags in there that you can actually rely on. Right now there's very little in that page that can be located reliably.


1

IList<IWebElement> list = driver.FindElements(By.TagName("img")); string aa = list[0].GetAttribute("src").ToString(); I would like to do somthing like this.


1

You should not use the _1UoZIX identifier. It's generated on the fly (dynamically) and changes over time. It also has no semantic meaning, doesn't say fridge at all Getting to the 'first search result image' element generically, i.e. first result and not just when it is that fridge... is going to be a challenge given the layout. One approach that might ...


1

This is a version incompatibility problem - your Firefox browser version is too old for Selenium3. Update your browser. My current setup which works for me: selenium 3.4.0 Firefox 54 geckodriver 0.17 All currently latest stable.


1

Here are the listed dependencies (as of 6/14/2017) capybara selenium-webdriver < 4.0, >= 2.0 Except version 3.4.1 due to this issue. s.add_development_dependency("selenium-webdriver", [">= 2.0", "< 4.0", "!=3.4.1"]) watir selenium-webdriver >= 2.46.2


1

Using the DevTool's Console in Chrome, I can confirm this selector works: document.querySelector("#container > div > div > div > div > div > div > div > div:nth-child(7) > section > div > div") So, in Selenium code: WebDriver element = driver.findElement(By.cssSelector("#container > div > div > div > div > ...


1

Most reliable way to locate element is by ID or name, or possibly CSS locator. Locating using other element attributes is less reliable. Least reliable is the one method you can find most often in questions (so you can guess that is most error-prone) - by XPath. Think how this functionality is implemented. WebDriver implementation has to have a own mirror ...


Only top voted, non community-wiki answers of a minimum length are eligible