Yes, you are right, from Chrome capabilities documentations
Use custom profile (also called user data directory)
By default, ChromeDriver will create a new temporary profile for each session.
Therefor you need to create and load a custom profile by user-data-dir.
ChromeOptions options = new ChromeOptions();
You are creating the Browser object inside the login function. When it ends, it is eligible for garbage collection.
You can pass a pointer to an object outside the function, so it will still have a reference when the function ends.
driver = webdriver.Chrome(executable_path="C:\Program Files (x86)\chromedriver.exe",options=chrome_options);
Testing APIs is potentially endless, just like almost anything in testing. I recommend focusing on one area rather than drowning yourself in something completely new. That would be a recipe for failure.
If you're completely new to the world of APIs, I recommend installing Postman (or any other client) and playing around with some endpoints for a bit. No need ...
If you are deciding to use better reusability in selenium-python, following are my experience based recommendations which are touch based with ISTQB Test Automation Best Practices:
How to structure or architect a test project with Python?
Better to follow generic Test Automation Architecture while building the repository:
It will depend if where you want to put the responsibility of this tracking.
Ultimately, you will have to keep track of the number of runs in the environment where you invoke the script (e.g., your shell) or, in the script, update a file where you keep track of the number of runs. In the second case, the tracking is independent of the way you run.
is css for contains and ^ start with for css
you can use any of the above locator to find the search field in linkedin
It looks like the OPs xpath selection is correct in order to find an element by title. To me, an error of "NoSuchElementException" occurs because the element is not in the DOM, not displayed, not clickable, etc before Selenium tries to interact with it.
The common solution here is to wait for the page to load or wait for element to be displayed. ...
Try to use developer APIs to perform this kind of actions against public sites like Facebook.
For multiple reasons, logging into sites like Gmail and Facebook using WebDriver is not recommended. Aside from being against the usage terms for these sites (where you risk having the account shut down), it is slow and unreliable.
The ideal practice is to use the ...
You could use Pabot: A parallel executor for Robot Framework tests.
From their GitHub page. You can find more advanced use-cases and documentations here.
Run same tests with two different configurations.
pabot --argumentfile1 first.args --argumentfile2 second.args [path to tests]
I am not very familiar with RIDE, but I think you can configure Pabot as an ...
There are some difference between the HTML shown through View Source i.e. using ctrl + U and the HTML shown through Inspector i.e. using ctrl + shift + I.
Both the methods are two different browser features which allows users to look at the HTML of the webpage. However, the main difference is the View Source shows the HTML that was delivered from the web ...
The way I've done this in C# is to have a test login normally and then set the cookies in the feature context. When a subsequent test runs, it looks in the feature context for the cookies, sets them, and then navigates directly into the app, bypassing the login.
To get the cookies, you need to call the Manage method on IWebdriver
var cookies = driver.Manage()...
There might some issue with the element visibility etc., but I can't see the whole code, so I'll react to only what's in your question:
get_attribute is a method, you are not calling it, you'd need something like get_attribute("class")
$682.0 is not an attribute, it's text, you need to get it with .text, e.g. driver.find_element_by_css_selector('....
the tag have two text node so you have to use the above locator , this checks if any text node of a has Event in it
you can also use:
This will convert all text node to string and then search event in it
Check your python architecture ( is it 32 or 64 bit)
Just type python and see
Open cmd in "Run as administrator" mode
run the command pip install robotframework-autoitlibrary
Now clone the autoit library source code: nokia/robotframework-autoitlibrary.
in the root directory run the below command: python setup.py install using cmd in admin ...
Both ways are fine.
I would recommend if you imagined how things would be if you were writing the State class driven by the tests, rather than having the tests afterward: Which option would you pick? Would you design the class so that it clients would be accessing its attributes, rather than sending messages through its methods?
If the answers are not ...
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(...
means driver of this object and your code cannot find any variable called driver for that object instance.
There is no instance variable driver:
action = ActionChains(self.driver)
do something like (if baseclass has a driver class variable)
from utilities.BaseClass import BaseClass
driver = BaseClass.driver
As per JMeter project main page:
The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance.
If you want to execute your Python code in JMeter you need to be able to run your Python code in Java, it's possible if you download Jython (Java bindings for Python) and ...
Just use implicit wait , you can also use explicit wait for each element also:
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
Did you try:
you can use any attribute as:
you can have multiple condition as:
//tagname[@attribute="attribute-value" and @attribute2="attribute2-value"]
//button[@data-ng-click="VerifyOrderInformation()" and @...
You can have lambdas to check for the character of each component ("is clickable?", "is visible?").
You can combine them to have a "is loaded" function for each page.
For the "wait for" actions, you can simply pool these lambdas, alongside a wait time and an exit strategy.
Thus, whenever you want to change how to ...
your text has a special character so you cannot convert to float
see the error
ValueError: could not convert string to float: Total Amount: $6.00
so the value of subtotalamt is
Total Amount: $6.00
this get only the number part
Note: This will check only the amount
next = driver.find_element_by_xpath("//div[@data-id='1']")
You should wait for an element before trying to interact with it. There are generally two options and do not mix use of the two.
Use implicit waits
from selenium import webdriver
driver = webdriver.Firefox()
driver.implicitly_wait(10) # seconds
myDynamicElement = driver.find_element_by_id(&...
when ever you want to find an element uniquely , and that element doesn't have a unique attribute then find a parent that has an unique attribute and use it as referrence
In your case the div tag is the referrence , if you want second drop down use:
product_id_box = driver.find_element_by_xpath('//div[@class="Site-secondary"]//*[@id="productid&...