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, ...


6

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)


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 ...


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: ...


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 ...


4

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 ...


4

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(); ...


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

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

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

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....


3

I am not sure what the code you have there do as it is incomplete. So assuming that you want to do data driven testing, use RobotFramework-datadriver: Structure of data file. Installation: pip install --upgrade robotframework-datadriver pip install --upgrade robotframework-datadriver[XLS] Create the excell sheet 1.xlsx and keep it in the same directory as ....


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

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.


2

The short answer is no. The longer answer is I'm not 100% sure but I'm fairly confident the answer is no. I've worked at Sauce Labs for a few years now, several of them in support. I've done a lot of hacking to try to make Safari and other Webdriven browsers play nice, and Safari has always been the most impenetrable. Since creating SafariDriver for Safari ...


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

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

The approach you are using works only with native check-boxes (i.e. <input type="checkbox"/>). What you have is a custom element that looks like a check-box and behaves like a check-box but which is not really a check-box from Selenium point of view. When you have custom check-boxes you need to obtain theirs states via the CSS properties ...


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

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

Lot of article are present on internet regarding GeckoDriver and Selenium 3. Gecko is a webbrowser-engine used in many applications developed by Mozilla Foundation and the Mozilla Corporation Gecko Driver is the connection between your tests in Selenium and the Firefox program. compatible clients to interact with Gecko-based browsers i.e. Mozilla Firefox ...


1

I'm not sure if you had googled it before you post your question here. Anyway, first you need to know what Gecko is. Gecko is a web browser engine used in many applications developed by Mozilla Foundation and the Mozilla Corporation. Where Gecko Driver is the link between your tests in Selenium and the Firefox browser. GeckoDriver is a proxy for using W3C ...


1

HtmlUnit does not have screenshot function, as the page is not rendered. Here is the feedback from the developers on a similar question: HtmlUnit is a headless browser, and makes no attempt to render content. This is the reason that the HtmlUnitDriver does not support the TakesScreenshot interface. If you need to take screenshots, then I'd ...


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.


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