Hot answers tagged

4

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(); options.addArguments("user-data-dir=/path/to/...


3

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); login(&...


3

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 ...


2

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: https://engineers-hub.teachable.com/...


2

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.


2

xpath: //*[contains(@id,"ember")]/input or //*[starts-with(@id,"ember")]/input css [id*="ember"]>input or [id^="ember"]>input is css for contains and ^ start with for css you can use any of the above locator to find the search field in linkedin


2

driver.get( "http://www.uitestingplayground.com/scrollbars") time.sleep(10) driver.execute_script( "arguments[0].scrollIntoView({'block':'center','inline':'center'})", driver.find_element_by_id("hidingButton")) https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView use inline and block options


2

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. ...


1

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 ...


1

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 ...


1

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 ...


1

Selenium webdriver can only be used for Web GUI Automation. Try using python module like pywinauto or Microsoft specific WinAppDriver for GUI Automation


1

executor.map(lambda p: login(*p) , (data ,proxy, scheme))


1

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()...


1

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('....


1

You can try as following driver.find_elements_by_xpath("//*[contains(text(), 'Event')]")


1

//a[text()[contains(.,'Event')]] 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: //a[contains(string(),'Event')] This will convert all text node to string and then search event in it


1

Check your python architecture ( is it 32 or 64 bit) Just type python and see For 32: 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 ...


1

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 ...


1

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(...


1

self.driver means driver of this object and your code cannot find any variable called driver for that object instance. There is no instance variable driver: def test_e2e(self): action = ActionChains(self.driver) do something like (if baseclass has a driver class variable) from utilities.BaseClass import BaseClass driver = BaseClass.driver This ...


1

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 ...


1

Just use implicit wait , you can also use explicit wait for each element also: driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe") driver.implicitly_wait(10) driver.get("https://aujtravels.com/easyneasy/")


1

Did you try: //button[@data-ng-click="VerifyOrderInformation()"] you can use any attribute as: //tagname[@attribute="attribute-value"] you can have multiple condition as: //tagname[@attribute="attribute-value" and @attribute2="attribute2-value"] so: //button[@data-ng-click="VerifyOrderInformation()" and @...


1

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 ...


1

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 use float(subTotalAmt.split('$')[1]) this get only the number part Note: This will check only the amount


1

There is a bug in that page , the next button is not fully displayed as footer is overlapping half of it . you can click using javascript if you are not using it to test something. THe code is as below , you have to do it for second next buttton also next = driver.find_element_by_xpath("//div[@data-id='1']") driver.execute_script("arguments[0]....


1

use xpath or css css : [class="message-component message-button no-children pg-accept-button"] driver.find_elements_by_css_selector('[class="message-component message-button no-children pg-accept-button"]')[0].click() xpath: //*[@class="message-component message-button no-children pg-accept-button"] driver....


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 driver.get("http://somedomain/url_that_delays_loading") myDynamicElement = driver.find_element_by_id(&...


1

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&...


Only top voted, non community-wiki answers of a minimum length are eligible