New answers tagged

0

It does something different. Java implementation shows: @Override public String getAttribute(String name) { return stringValueOf( execute(DriverCommand.GET_ELEMENT_ATTRIBUTE(id, name)) .getValue()); } and @Override public String getText() { Response response = execute(DriverCommand.GET_ELEMENT_TEXT(id)); return (String) response.getValue(); }...


0

If the [SetUp] runs without exception the [TearDown] should to. So, this usually only happens when I 'Debug' my tests. When it does I can kill the orphaned drivers with this cmd, kill -processname chromedriver -ErrorAction SilentlyContinue or just hit 'Continue' in the debugger to let things play out naturally.


2

I found the solution to this myself. For anyone who's having the same issue: What I did wrong was I used driver = new ChromeDriver(options); in my code instead of driver = new RemoteWebDriver(new URL("http://my.aws.ip:4444/wd/hub"), options); After making this change, I downloaded selenium-server-standalone.jar to in EC2. Then, before starting the ...


2

We would get colors as expected if we had developed code like: <button id="slide" type="button" onclick="dem_func();" style="color:orange;">Slide right</button> The below line is trying to get the color name from the 'inline' color element instead of "<style//>" css block: document....


0

There are two issues you need to think about; You are running on headless mode, so there should be no visible Chrome window. You may need to disable it. If the Jenkins initiated the job; you can see the Chrome window, only if you VNC with Jenkins user, not another account/user.


0

getCellType returns a object with type CellType you should call the name() method to get the actual type from this object. public class ExcelReader { public static void main(String[] args) throws IOException { String path = "C:/Files/TestData1.xlsx"; FileInputStream fis = new FileInputStream(path); XSSFWorkbook workbook = new ...


0

WebdriverIO is Javascript based automation framework that follows an asynchronous execution approach and consequently, webdriver's execution speed doesn't match. We as an automation testing services providers follow the below mentioned approaches according to the scenario to handle this behavior of Node.js based frameworks. First: We can use "callbacks ...


0

Below code snippet is to check the element is exist or not .Please tryout the code .... public boolean isElementExist(WebElement element) { try { return element.isDisplayed(); } catch(NoSuchElementException e) { return false; } }


3

You should get the CSS value instead of attribute.Below sample code will print the background colour before and after click WebElement.getCssValue("cssproperty") will return respective css property of the element WebElement body=driver.findElement(By.tagName("body")); WebElement button=driver.findElement(By.id("slide"));...


0

Please check removing sleep threads. And try running wether after any exception the driver closes the browser. Probably problem is with sleep threads where in between its control stuck or may control is not getting return to driver. Also add console.log('') between the each line statment will help in debugging or f11


0

You can get the count of child elements under then you can implement if else condition like below if that child elements count equal to 2 which means your DOM has Previous and Next Arrows if that child elements count equal to 1 which means your DOM has only one Arrows( this scenario again verify that element is next arrow button or not) you can get count ...


1

I think you should click day picker next month arrow 1st, then only your element (Previous Month arrow ) will come and appear in the DOM After that you can verify that element present or not now your are checking not display and not present element in current DOM that's why it is throwing unable to find Such element


1

Check if you have correct sheet name. As you can see in stacktrace, error happens in ExcelUtil line 27. Debug/Print the sheet name to see if the value is correct.


0

Okay, first of all you need to set up your grid to start with 5 Firefox nodes, you can do that by adding -browser "browserName=firefox, maxInstances=5" –maxSessions 5 when you call the servers jar file. Then you need to parallelize your execution. The easiest way to do so is to pull the the url out of sys.argv and just start 10 processes and ...


1

As per https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/interactions/Actions.html Actions.clickAndHold(element) Clicks (without releasing) in the middle of the given element. This is equivalent to: Actions.moveToElement(onElement).clickAndHold() Actions.moveToElement() Moves the mouse to the middle of the element. The element is ...


0

There are some steps in debuging NoSuchElementException: First wait for item to be present: https://selenium-python.readthedocs.io/waits.html Check if the element is in an iFrame. You need to switch to the frame first: https://selenium-python.readthedocs.io/navigating.html#moving-between-windows-and-frames For more debugging steps and ideas read: How to ...


1

driver.get().findElement(By.xpath("//div[@id='example_paginate']/span/a["+outerIndex+"]")).click(); Here when the page-load you are in index tab one already After the first iteration, you are again clicking the same tab as outerIndex is still 1 so it counts page one content twice So for fix, just keep the click action at the start ...


0

You don't use the Test Parameters when using Cucumber, you use the Scenario outlines. So, when you have: Scenario Outline: Login As User When I log in as '<user>' Examples: | user | | xyz@gmail.com | You would have your test step definition handle that by using an Excel reader. @When("^I log in as \"([^\"]*)\") ...


0

pass the version as mvn install "-Daspectj.version=1.9.6" or Hardcode the version: <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.6</version> </dependency>


4

Get the text and add to a array Convert array to set and compare the size Set will have only unique elements (Removes the duplicates) So if length of set and array are different , it means there where duplicate entries in the array. var arr = [55, 44, 65, 55]; var set = new Set(arr); console.log(set.size === arr.length); set.forEach(x => {console.log(x)});...


0

Here you are neither quitting the driver after test nor you logging again in the script. So you are using the same logged in instance in the second test. Selenium doesn't cleans anything until you are using driver.quit or close. So here if you are running second method directly before running the first one it will definitely fail and will throw the error ...


0

When I have tackled this in the past I used a loop and TouchActions. Treat the following sample as pseudo-code. var element = driver.findElement(mySelector); while(!element.IsPresent) { TouchAction() .press(100,100) // Start at 100,100 .moveTo(200,200); // Passing absolute values of 200,200 ending up at 200,200 element = driver.findElement(...


0

We as a company are providing automation testing services. Our approach is to use Xpath as last priority i.e when no other option is available like ClassName, ID, LinkText, CSS etc. Here we can directly use "LinkText" and above can be make functional like using the below syntax. WebElement link = driver.findElement(By.linkText("Dados Pessoais&...


1

At our company we had about 1000 selenium tests. We ran the tests for every push (as part of a CI process), and what we did to make the tests stable is to simply run the failing tests again, and then again. If after 3 times the same test failed, the build would fail too.


0

It looks like you are trying to handle an alert. You cannot handle alerts in this way. https://www.techbeamers.com/handle-alert-popup-selenium-python/ for some background for example may be what you intend. Alerts are tricky, and thus far I've avoided having them in our application code for this reason. This SO post may be what you want to be doing https://...


3

You won't get blank data as its a IWebElement type list. If you meant that when you try to get text it returns empty for few elements then use: elm = elm.Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); You will get elements for which Text is not Null or empty: Reference: https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.where?view=...


1

if html code is <div value="your expected text"> try: element.getAttribute("value") if html code is <div>your expected text<div> try element.gettext(); or element.getAttribute("innerHTML"); I met one fail case by gettext() but it worked by getAttribute("innerHTML") div is just a tag name used for ...


1

While I don't recommend this approach as it does not conform to F.I.R.S.T. (Fast, Isolated/Independent, Repeatable, Self-validating, Thorough) you can accomplish a reusable session by not tearing down after each test. It differs slightly depending on the Test Runner you are using MSTest/VSTest, NUnit, XUnit but are largely the same. For NUnit you would use [...


0

Capture a screenshot of PDF and compare it with expected image. Article linked here implements image comparison http://automationtesting.in/image-comparison-in-selenium/#:~:text=Practically%20speaking%20image%20comparison%20is,use%20to%20compare%20two%20images. Download PDF as a file and compare it with expected file. Article linked here implements Comparing ...


0

There're a few options. 1/ getting the element by what's not dynamic in its id //div[contains(@id, "popup")] 2/ using css .ui-dropdown-panel.ui-widget-content.ui-corner-all.ui.shadow 3/ asking developers to build in a unique test id for you e.g. there could be something like data-test-id=popup, then you'd use a css selector like so: [data-test-id=...


0

Right click on pop up and see is there any frame available. You need to switch to alert. Alert alert= driver.switchTo().alert();


Top 50 recent answers are included