I would consider the whole idea of verifying such logic from the UI perspective as a bad practice. See info on test pyramid.
If you need to test the calculation logic of your service - you can do that on the unit and/or integration testing level, which would be much easier to do, since you will be free from external dependencies in that case.
You can easily reuse code in TestCafe using Page Object model/pattern.
The way I organise a TestCafe project in the project dir is the following:
In Objects/, you can declare a class that represents something on your ...
<div class="input group">
<button class="btn btn-default">
<i class="fa fa-clock"></i>
You would want to use the following selector for the ...
Browser supports only XPATH version 1.0 and matches is an XPATH 2.0 method, and so you can use only xpath 1.0 in selenium. The above linked document shows the supported XPATH methods.
so in your case
//mat-option/span[text()="someting" or text()="something" and so on ]
You can use //mat-option/span[condition1 or condition2 or condition3]
With XPath 2.0 or higher you could also use
But sadly the developers of Selenium are still stuck on XPath 1.0.
Are you sure you want "text()" here rather than "."? With text(), the text must all be in one text node: no ...
Seems your switching tab is not working properly. Please check that new tab handler is okay.
# collects handle ID of current window
first_tab_handle = driver.current_window_handle
print("first_tab_handle : "+str(first_tab_handle))
# collects handle ID after new tab is opened
print("current window handle : "+ str(...
Your code is working fine , which protractor version are you using. Try using full path as mentioned in other answer and also try replacing CHromeoptions with googchromeOptions if first is nt working (new protractor version everything should work fine with justt chromeoption):
The ChromeDriver documentation states "Relative paths do not always work. For best result, use full path instead.". Explanation why it's not always working is lacking though. Using an absolute path should fix the issue. Detailed information can be found in the links below.
Based on the HTML, I would say that the problem you are having is that the page shows and hides fields based on where you are in the checkout process. Because of this, you should probably be using conditional waits - Wait.Until(ExpectedConditions.ElementExists(By.Xpath(yourxpath))); (Do not use my code - I'm familiar with C# so my examples follow C# syntax, ...