New answers tagged

0

Your first attempt would work if the button was not disabled. Your other attempts are failing because <span> elements aren't clickable. My suggestion is to first locate the <button> element, then use Javascript Executor to enable it. At this point you will be able to click it. In a c#-ish pseudo-code, this would look something like this: ...


0

It looks like you are trying to click a disabled element. If the button was not disabled as it seen in the first tag; WebElement button = webDriver.findElement(locator); button.click();


0

The solution as you said would be iterating the dropdown with a loop. Since your question was not clear on; is there multiple dropdown or based on previous scenario the count of options are changed I will assume the later one is the question and my answer will be based on that. What you can do is: Try to find every element exists in the dropdown Exclude &...


0

Authentication via the URL has been deprecated for a while: While this may sound like a thunder from clear skies for Chrome users, it is not. The deprecation “order” comes from RFC 3986: ... 3.2.1. User Information ... Use of the format "user:password" in the userinfo field is deprecated. https://medium.com/@lmakarov/say-goodbye-to-urls-with-...


0

As per the TestNG documentation for rerunning, Every time tests fail in a suite, TestNG creates a file called testng-failed.xml in the output directory. This XML file contains the necessary information to rerun only these methods that failed, allowing you to quickly reproduce the failures without having to run the entirety of your tests. So, you just need to ...


1

No, not by default. It could be possible, but you need to store which code can be skipped and somehow put this logic in your tests. This would create a pretty complex test-framework. Make your tests shorter :) WebDriver tests should run in seconds, not minutes.


0

This can be done with extra filtering in Python, but the usual straightforward way is to add an extra condition to your CSS selector: all_items = driver.find_elements_by_css_selector("ul > li") versus: filtered_items = driver.find_elements_by_css_selector("ul > li.myclass") where . is a class selector.


0

Python has a feature called List Compreenshion, aimed at creating lists from other lists, after applying some processing on each element. 1 - Find the li elements: li_items = driver.find_elements_by_class_name("li") 2 - Filter in only element with a given class: li_items_with_class = [ item for item in list_items if "my_class" in item.get_attribute("...


0

With chrome the setup is a little different. I'd need more info to help. Were you able to connect before and it recently stopped? If so I would say to make sure you have the most up to date driver. Is this the initial setup?


0

If I understand the question correctly, you only need to manually move to the element on test failure. In normal circumstances, the driver is automatically moving to any element it needs to interact with? I would suggest using error handling to execute the "scrollIntoView" code that is in your question. The Protractor FAQs show how you implement error ...


0

When we try to find Shadow DOM elements using selenium locators, it will throw 'NoSuchElementException'. To access these Shadow DOM elements, we need to use JavascriptExecutor executeScript() function. If you look at the DOM structure, every element that has ShadowDOM also has a shadowRoot property which describes the underlying elements. public WebElement ...


0

Ok, so apparently what you need to do is capture some WebElement on top of the page and then move mouse by offset using Actions class. Using Java it would be something like this: WebElement topElement = driver.findElement(By.SOME_SELECTOR); Actions action=new Actions(driver); action.moveToElement(topElement).moveByOffset(0, -100).perform(); It ...


0

I did it using Sikuli: //imports import org.sikuli.script.FindFailed; import org.sikuli.script.Pattern; import org.sikuli.script.Screen; //Code Snippets Screen s = new Screen(); Pattern browserCloseButton = new Pattern(filepath + "CloseButton.PNG"); WebDriver driver = new ChromeDriver(); driver.get(<url>); s.hover(browserCloseButton); For more ...


2

I don't see all html So I'm guessing that you can try: 1/ id: WebElement elementName = driver.findElement(By.Id("rpn")); 2/ Xpath: //a[text()='123456'] OR //a[@id='rpn' AND text()='123456']


8

Page Object and Selenium's PageFactory are distinct things in nature, usually the latter complement the former. Page Object is a design pattern aimed at solving the problem of separating the application interface from the HTML interface. Why do we separate these interfaces? Because web pages elements and functions, as saw by the user, differ from the HTML ...


0

You should specify the chromedriver.exe executable file path: driver = webdriver.Chrome(executable_path=r"C:\Chrome\chromedriver.exe") For Windows, Allow Read & Execute Permissions on chromedriver.exe for Everyone: Right Click chromedriver.exe > Properties On ChromeDriver On ChromeDriver Properties Window > Security Tab, click Edit On Permissions ...


0

This is what the Actions class is for, there is a "moveToElement()" function in each implementation. This is more or less how it will look like in Protractor: browser.actions().mouseMove(element).click().perform(); This link explains the usage


0

According to you statement, it looks like clear fails to clear field. Can you try to add following code into the automation to clear up field and test it with it? static String getValueFromElement(WebElement locator) { return tryFindElement(locator).getAttribute("value") } This method above will return you the what's written in the element. ...


0

According to the Azure pipelines the Chrome version is 75.0.3770.142. See: https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2019-Server2019-Readme.md So unless you create your own image you cannot just blindly upgrade the browser/driver version. You will have to wait until they update their pipelines aswell. Also the ...


0

Masonry has an event system. You could bind an layoutComplete event to set a global variable to true and poll that with the WebDriver JavaScriptExecuter. This answers also explains how to use the JQuery.active state to monitor if the page is still working on rendering. Masonry seems to be often used with jQuery, so maybe that is a possible solution. ...


0

Make sure that before sending the text,filed is clearing properly. add assert before sendkeys to make sure that text field is empty


0

Don't use absolute xpath at all. Use relative xpath. Try to use css locators were you can. Web elements could be located using tag, attributes , parent, child , text and lot more. Just see what is the easiest approach and clearest approach. For instance , the xpath you mentioned doesn't give any idea about the element. The locator we use should be mostly ...


0

You can use a bit of inheritance, which helps you to extend without dealing too much with data providers: public abstract class AbstractTest extends TestBase{ protected User user; protected AbstractTest(User user) { this.user = user; } @Before public void setUp() { authenticateUser(this.user); } } public class UserWithEmailsTest ...


0

I think you are missing out the definition of "Framework" https://smartbear.com/learn/automated-testing/test-automation-frameworks/ A framework is comprised of a combination of practices and tools that are designed to help QA professionals test more efficiently. These guidelines could include coding standards, test-data handling methods, ...


0

You might be interested in JDI Light framework. This seems to be actively (more or less) maintained and evolved from former JDI that used to feature a lot of useful staff but is no longer supported as far as I understand.


1

TL;DR: There is no need for a framework at all. Using frameworks does not speed me up, just adds more complexity. Keep it simple! Most of the "Frameworks" classes that I build are Domain specific. For example setup test users by code. Clean up environments before test-runs. I dont like to call it a framework, that would make it bigger than it is. It is not ...


0

I don't know the exact answer but maybe can help find the solution. Have you tried finding out if this is actually the correct window handle? You could try debugging by: Counting the number of window handles Opening the last window handle in stead of exactly [1] Reading the DOM of all window handles to see what is found by executing this script over each ...


0

Some things to try when handling this: Learn how to make better selectors, non-relative selectors are a bad-practise most of the time. Read: What makes a good selenium locator? Sit with the developers and add stuff (e.g. CSS, Id's, etc) that MAKES it testable! Adding code to an application to test it is a GOOD thing! <= prefer this Clean the data before ...


0

Always write short relative path which is independent of DOM hirarachy changes as much as possible. In your particular case how about focusing on just last div unique properties for identification. Ex: 'div[AnyUniqueProperty="Value"]


1

Your solution is good. But if it's only different from locators but same steps. I usually use only xpath and separate string of locators from each page. public class aLogin{ string str_username = 'xpath to username text box of page A'; string str_password = 'xpath to password text box of page A'; } public class bLogin{ string str_username = 'xpath to ...


1

It turns out the reason chromedriver knows where chrome is installed is it looks for it in the default installation locations. See chromedriver requirements I ended up using writing this script. def chrome_version(): osname = platform.system() if osname == 'Darwin': installpath = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ ...


0

In your particular case as far as I understood your target element is getting shifted in the list after a new item is added before it. If this is the case you can get the access to that element from the end of the list. For example this element could be always the last one. Then you should use: /html/body/div/main/div/div/div[2]/div/div/div/div[1]/div/div[...


-1

One note: You should consider not only brittle, accessibility and performance is important. Performance will vary depending on the method you use. For example ID is faster than XPath. This will be important as your tests increase.


3

If nothing in the web page is predictable, then you're hosed: you can't find gold in a sea of shifting data unless you have something to hold on to. If there's some constant factor in the web page that is stable, whether it's the structure, an ID value, or some textual content, then tell us what it is, and we can help you translate that description into ...


0

I had a similar problem recently I had to add extra options to set the download path for headless. var options = new ChromeOptions(); options.AddArgument("--headless"); options.AddArgument("--disable-extensions"); options.AddArgument("--disable-gpu"); options.AddArgument("--disable-dev-shm-usage"); options.AddArgument("--no-sandbox");...


3

We should always prefer the relative path to avoid these situations, don't use absolute XPath


0

Base on Id of element locator, I assume that it is id of auto generation so you should 1/ Check if it was fixed (or NOT) after every reloading by asking developer or turn on inspector of browser then try reload page and observe that id. 2/ If Id was fixed, I suppose that you should increase time of waiting for element locator because Id is too long and ...


1

You can obtain the browser version via WebDriver like this: Capabilities cap = ((ChromeDriver) driver).getCapabilities(); System.out.println(cap.getVersion()); I have tested it on Windows using old WebDriver version (2.44) vs current Chrome (78), I am not sure how this will work with new WebDriver vs old chrome on Ubuntu.


0

Why dont you use the chromedriver from the repo? Should be the same version, when OS == Linux don't run your get latest chromedriver script. I think this is much simpler than detecting the Chrome version, which would be different code for each OS. The command --version should work if you hard code the location for each OS, detect the OS instead.


0

Did you try to read the documetation for the Selenium Python package? See: https://selenium-python.readthedocs.io/navigating.html Code example from the documentation: from selenium.webdriver.support.ui import Select select = Select(driver.find_element_by_name('name')) select.select_by_index(index) select.select_by_visible_text("text") select....


0

I do something similar (albeit in C#): using System.Diagnostics; namespace <Redacted for privacy>.Helper_Classes { public class KillDriverObjects { public void KillOpenChromeDrivers() { Process[] killChrome = Process.GetProcessesByName("chromedriver.exe"); foreach (var process in killChrome) ...


2

Yeah, it can be a general issue as browsers (especially Chrome) don't always like closing their driver processes. You can put the below in the onFinish all tests method which kills them: String systemType = System.getProperty("os.name").toLowerCase(); if (systemType.contains("win")) { try { // Selenium drivers don't ...


0

It works and then stops the execution of subsequent code. So I tried using Promises: this.driverWait = async function (explicitWaitMS) { // create a new promise inside of the async function let promise = new Promise((resolve, reject) => { setTimeout(() => resolve(true), explicitWaitMS) // resolve }); // wait for the promise to ...


1

Yes, you need apple developer ID , to build and deploy your project using Xcode on your real iOS device.


0

I don't know what you're reading however I would recommend stopping referring this source as they don't really realize what they're talking about. According to The WebSocket API documentation: The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. ...


0

The best way to prioritize elements of learning (what to learn first, which part of a complex issue to understand first) is by actually doing something useful with it. That is the way the brain learns the best (engineering problems come first and the abstract theory comes later to explain all of the elements in a high-view manner). Therefore, you will ...


2

Same position as me. Starting as Testmanager and shifted to Test Engineer I was having troubles to understand how test automation worked. For the beginning I would not start with mobile testing. Testing with Websites is more convenient. What helped in my case: Understand how the DOM structure works esp. locators (xpath, css, id, etc.) After you got a ...


1

Automate an dummy application end to end testing "A journey of thousand steps starts with an single step" - Lao Tzu I would suggest to take an real/ or dummy fully working application and automate full end to end test cases but take baby steps each day consistently for few months . Deliberately introduce few bugs in the application , to make sure ...


0

Automated testing requires more discipline compared to manual, Learning automation is not difficult but it requires a focused and planned approach. First, you need to know one programming language preferably Java or C# & You need to know about following. Selenium Webdriver API. Apache POI API for reading and writing data to excel. Log4j logging Utility ...


1

Start your test with a clean-up. For me it is a best practise to set the state of the environment under test. This might mean deleting some files or database records. Now it could be a defect, if you expect the same script to be runnable over and over again.


Top 50 recent answers are included