New answers tagged

0

You can use find_elements_by_xpath (note the s) to find all elements that match a search. all_rows = driver.find_element_by_xpath('//*[@id="tblDocumentosEnviados"]/tbody/tr') Then you can filter out the rows using: rows_for_feb_2020 = [row for rows in all_rows if (put here a boolean expression to discover if a row is of 02/2020)] Then you can click in ...


1

As @Gkalnytskyi has already pointed out, web scraping is the area you should approach for your objective. Python and BeautifulSoup together with the headless Chrome driver are a combination that you could go with. BeautifulSoup is a Python library for pulling data out of HTML and XML files. Chrome Headless is a socalled headless web browser that can be ...


0

What is Documents.exe? It looks like you set the chrome driver path to that file but that doesn't look like the chrome driver. You will have to download the latest chrome driver from here: https://chromedriver.chromium.org/downloads and then set your path to the chrome.exe that is downloaded from there. Once you have the driver downloaded, move it to any ...


0

Use click and hold instead of click, the click will just click the mouse and releases it suddenly. The below code is an example: System.setProperty("webdriver.chrome.driver","c:/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.manage().timeouts()....


1

Use browser actions, Actions builder = new Actions(driver); builder.moveToElement(driver.findElement(By.xpath("//input[@type='file']"))).click().build().perform(); The input element may not support the click action that's why you are getting the invalid argument error.


0

Forget Protractor for non coders, not only do they need to learn Typescript, the have to learn Selenium. Instead check out Cypress Easy and fun, more powerful than Selenium...all http requests can be intercepted.


-1

A partial answer could be using cucumber with protractor, you'll have the stability of Protractor with the simplicity of cucumber's DSL. You can actually choose any other test framework to be used with Cucumber, like Cypress, some frameworks are better fitted to some scenarios than others, here's a good introduction (although it is slightly outdated, for ...


2

For 20 years now, there's been a huge gap between QA and DEV teams. Most QA people are not programmers and many don't want to become programmers. This gap has never really closed, rather it's being masked a bit; that on Agile teams today, the developers are expected to write Unit Tests on each Sprint. Unfortunately due dates make it impossible to spend ...


0

the exception shown is: FAILED CONFIGURATION: @BeforeMethod setUp java.lang.NullPointerException at com.ecinteractive.base.TestBase.initialization(TestBase.java:50) So from (TestBase.java:50), we can say that the exception was thrown at line 50 of TestBase class. On analyzing the line 50 of TestBase, we can see the code that throws the error is: ...


0

This will find the correct input: //div[@data-bind='control: EffectiveDate']/input (I would have commented to the above answer, the difference is in using the single vs double quotation for attribute values, but cannot add comments yet so added a new answer)


0

This may happen when your create your XLS/XLSX file through LibreOffice. Apparently something is lost in the conversion and the file is not the same as a spreadsheet made in Microsoft Office. I had the same error and the solution for me was copying all the work I have done in LibreOffice Calc to a MS Excel spreadsheet and then save a new file.


1

What happens if you use: //div[@data-bind=\"control: ExpirationDate\"]/input and //div[@data-bind=\"control: EffectiveDate\"]/input


0

I encountered a similar situation where I need to write an xPath for an element shown below: Element: <img src="webwb/pzspacer.gif!!.gif" class="inactvIcon" data-ctl="["DatePicker"]" style="cursor:pointer;"> I was able to grep the element using below xPath, where I used the backslash to escape the characters [ and ". Xpath: //img[@data-ctl='\[\"...


1

Please provide the date picker html DOM , and also your code in page object . Assuming you are using getText() to get value from a field eg day.getText() , change it to day.getAttribute('textContent') ,or day.getAttribute('value') and see either of them works


2

Did you try: elem.sendKeys(Keys.CONTROL,"a"); Output And about your code: It is failing because you are passing WebElement password = driver.findElement(By.id("passwd-login")); highlight1(high,password); Instead of WebElement password = driver.findElement(By.id("passwd-login")); highlight1(driver,password); Highlighted output:


0

THIS IS MY CODE. IN THIS I AM HIGHLIGHTING USERNAME, PASSWORD FIELD. public static WebDriver driver, high; public static void highlight(WebDriver driver, WebElement ele) { JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].setAttribute('style', 'background: grey; border: 2px solid yellow;');", ele); } ...


2

Use the below function public static void highlight(WebDriver driver,WebElement element) { JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].setAttribute('style', 'background: yellow; border: 2px solid red;');", element); } Where driver is your WebDriver instance and element is the WebElement which is to be ...


0

After login step use Webdriver Wait to wait until some of the element of landing page(after login) is displayed. For example, if you have an account username UI element in the landing page you can make WebDriver to wait until the element is displayed WebDriverWait wait==new WebDriverWait(driver,10); wait.until(ExpectedConditions.visibilityOf(element)); So ...


0

First, Cypress is said to have an easier onboarding than Selenium, where all you need to do is install the .exe to get up and running sine all the drivers and dependencies are automatically installed. With Selenium, on the other hand, you need to spend a little more time getting everything up and running. One of the advantages of Selenium is ...


0

package automation.selenium; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Print_allthe_product{ public static void main(String[] args) throws Throwable { System....


3

The below command , DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0 downloads the web driver usually to system32 folder which is already in PATH variable. That's why your protractor scripts work fine in your local system. To run it in the other system to which you copied the webdriver, follow any of the below approaches: ...


0

Can you please specify Robot and Pabot version you are planning to use. First point: If you read the GitHub readme page, in the "Things you should know", it states: Pabot will split test execution from suite files and not from individual test level. https://github.com/mkorpela/pabot/blob/master/README.md So there is nothing to do on test level, except if ...


2

Yes, you can assign a particular port explicitly to your web-driver execution. If you know the port you want to connect to, then you can directly connect to it using selenium with below code. System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver.exe"); chromeOptions options = new ChromeOptions(); options.setExperimentalOption("...


1

Runnin chromedriver on a specific port: You should use ChromeDriverService for starting chrome in a different port: import org.openqa.selenium.chrome.WebDriver; import org.openqa.selenium.chrome.ChromeDriverService; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.RemoteWebDriver; ...


1

You can also suppress error message using ChromeDriverService class: WebDriver browser = null; ChromeDriverService service = new ChromeDriverService.Builder() .usingDriverExecutable(new File("C:\\chromedriver.exe")).usingPort(4444).withSilent(true) .build(); service.start(); browser = new RemoteWebDriver(...


0

You should be trying to retrieve the value of the field, as text entered into one is not stored in "text". Give this a try instead of .getText(): .getAttribute("value")


1

This may help you to assign a particular port explicitly to web-driver execution System.setProperty("webdriver.chrome.driver", "your driver path"); chromeOptions options = new ChromeOptions(); options.setExperimentalOption("debuggerAddress", "yourcustomport"); WebDriver driver = new ChromeDriver(options);` Custom port should be provided along with your ...


0

As Daniel said in his comment - somewhere in your code is an Implicit wait, which is set to 2.5 minutes. I suggest you ask someone who put it there, what was the reason behind it. If that is not possible, you can set it to 0 right before your code like this: driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); and then, once you are done set it ...


4

Selenium IDE has no version control integration, at least for now. All the test info is written in a .side file (unless you are using code export to another language). If you've set up git correctly, you should be OK, provided you are not trying to work at the same file at the same time. Just commit different tests in folders you agreed on. However, I ...


1

use this: obj.FindElementByCss('[class="afpaas-quick-link ng-scope afpaas-condition-mobile-display"]') Also check iframe, waits etc as mentioned in the link in comment


0

Try using //a[contains(@href,"q1_new-trading-order")]


1

There is a nice article about progressive testing by Mphasis: https://www.mphasis.com/home/thought-leadership/blog/test-automation-regressive-vs-progressive-automation.html Progressive automation is to automate almost every test case instead of executing test cases manually. This is typically seen with the projects that run in agile methodology. You ...


0

Basic Auth via url was deprecated and even removed in some version of chome. But then they revert this functionality back and now you can use it.


1

This is a duplicate question of below : https://stackoverflow.com/questions/30587454/difference-between-beforeclass-and-beforetest-in-testng since you asked site to refer please consider below websites: You can refer below link: https://www.guru99.com/all-about-testng-and-selenium.html


0

What's the problem then? Both xPaths seem functional. On the other hand, a good practice is to simplify it as much as possible, so it's readable for you in the future and for other people. The following xPath seems a bit more readable to me: //div[@id="opbox-category-tree"]//a[text()="Drukarki i skanery"] You don't need to write every element on the way ...


0

You are referencing non-static fields (name and surename) from a static context (execute method), which doesn't work. Have a look at e.g. this question on Stack Overflow. To solve this problem, you can either make the fields static too or create a NewUserFormAction object. Personally, I would prefer the latter. Check out this code, where I also applied some ...


1

Canvas is just like any other element, see the below code that uses google map and prints the outer html of the canvas tag. so you can get the element attributes like you would for any elements: var EC = protractor.ExpectedConditions; await browser.get('https://www.google.com/maps/search/microchip/@51.8959843,-8.5330895,12z?hl=en') await ...


2

The short answer is no, it's not possible to use Selenium or the JavaScript Executor in Selenium to automate the HTML canvas. I've tried to do this on a project once with Puppeteer, and it's the same problem. Keep in mind that the HTML canvas is a black box, so Selenium, Puppeteer, or any other browser automation tool that uses the DOM to locate and ...


1

Assuming that the process should move to [Teardown] annotation. Then you should not use the try-catch inside the test annotations because Test annotations provide test results based on the Exception so try by removing try-catch blocks Reference: https://stackoverflow.com/a/111270/10858089


6

@BeforeTest method runs before the test method, belonging to the classes inside the tag. It is called once for each test tag. It is used to initialize common objects between different test classes inside one test tag. @BeforeClass method runs before the class is invoked. It is called once for each test class inside the test tag. It is used to initialize ...


0

I think you need to double check the usings and recompile. OpenQA.Selenium.Internal should be OpenQA.Selenium. You are trying to call a moved interface. Per v4.0.0a1 in https://github.com/SeleniumHQ/selenium/blob/master/dotnet/CHANGELOG "Moved IWrapsDriver and IWrapsElement from the OpenQA.Selenium.Internal namespace to the OpenQA.Selenium ...


0

If you added the msedgedriver.exe to your project manually you also need to set the Copy to Output Directory property of the file. Because non-code files are default not placed in the build directory bin\Debug. Double check the driver is indeed copied to the directory. Instead of hardcoding the path to the output directory you could try: var ...


2

Even though you can do it using seleniums built-in cookie manager I wouldn't recommend doing so if you're looking for security gaps. The WebDriver acts with much higher privileges than an actual attack scenario would (just look at seleniums switch_to which basically circumvents the same-origin policy, something a real attacker would have a really hard time ...


Top 50 recent answers are included