Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [python]

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.

Filter by
Sorted by
Tagged with
1
vote
2answers
524 views

Use an if-statement to ensure that an element is not present

I would like to use a if statement to ensure that an element is not present without rising a NoSuchElementException. So for example: if(driver.find_element_by_xpath("xpath")): print " This ...
1
vote
2answers
110 views

A logical “or” inside a Selenium test case

Assuming I would like test for a default Apache server response at one point, and I would like to make it platform agnostic. For CentOS I have: def test_web_interface(self): self.driver.get(...
1
vote
1answer
477 views

Anyone find value migrating to NightWatch from Python Selenium API?

My dilemma, I have tons of tests and experience on the Python API to Selenium and webdriver. But, my dev team is big time javascript fans who think everything should be built under node/js. I want to ...
1
vote
2answers
487 views

Installing ddt on Ubuntu with Python 3

I am working on a Ubuntu system which has both Python 2.7 and Python 3.4 installed. I was trying to install the ddt library for creating data driven test cases. However when I try installing using pip:...
1
vote
2answers
15k views

Unable to find element in selenium

I'm using the following code: if i[1] == "id_text": inst = driver.find_element_by_id(i[2]) #inst.click() for option in inst.find_elements_by_tag_name('option'): if option.text == ...
1
vote
2answers
11k views

Selecting xpath using a variable in selenium 2

I am doing a selenium automation where I want to pass the variable into the XPath and select the element. The xpath which I am trying looks like: browser.find_element_by_xpath("//span[contains(.,'...
1
vote
1answer
3k views

How to use databases within the python unittest framework?

I have a bunch of unittests written in python in which messages (text) of any kind is used. Instead of 'hardcoding' the text examples used for the tests I would like to use a database of some kind (...
1
vote
2answers
37 views

Can not choose button with the same name (Windows)

The problem I have two buttons with the same name in Windows program. So I do: "self.driver.find_element_by_name("button name").click()" - it selects the first one, but I need the second one. I ...
1
vote
1answer
225 views

Selenium | Locate elements via custom attribute

I'm new to test automation with Selenium (Python) and just wondering if it makes sense to locate elements on webpages via a custom attribute? In some places the IDs of the elements are generated and ...
1
vote
1answer
1k views

Selenium python drop down menu select

I need to select an element from a drop-down menu. The dropdown menu has two value and I need to select the second "sponsor.com" <select tabindex="1" name="userDomain" onchange="javascript:...
1
vote
1answer
63 views

Interacting witrh elements in the new link using Selenium(Python)

I am writing a Python script for interacting with the Spotify Webplayer. Initially I have to login by entering the credentials. After I click the login button and I get redirected to the webplayer ...
1
vote
1answer
979 views

How to download in headless mode with selenium?

I have a test running to download files from a website, the files download okay without the headless argument chrome_options.add_argument('--headless') but as soon as I add this line nothing downloads,...
1
vote
1answer
873 views

find_elements_by_xpath issue!

I'm trying to complete the basic python Selenium demo (https://selenium-python.readthedocs.io/getting-started.html) but I'm attempting to do that same procedure on https://www.ncbi.nlm.nih.gov/. ...
1
vote
1answer
659 views

How can I prompt for input using Selenium/Webdriver and use the result?

i know this has been asked before but the last time it has been answered was about a year and a half ago main point is i want to from selenium import webdriver from selenium.webdriver.common.keys ...
1
vote
2answers
2k views

python selenium - waiting for item to load (stale element reference error)

I am executing a script which clicks through a number of pages to retrieve data. After each click the new page obviously has to load and the time to load varies greatly (mostly 2-3 seconds, sometimes >...
1
vote
1answer
8k views

Download pdf in headless chrome and selenium

Script.py profile = {"plugins.plugins_list": [{"enabled": False, "name": "Chrome PDF Viewer"}], # Disable Chrome's PDF Viewer "download.default_directory": source_dir, "download....
1
vote
1answer
6k views

How to open browser with extension already enabled

I get the following code to open chromedriver with extension but this extension is disabled, Is there any way that when chrome is launched, it launch with enabled extension - chrome_options = ...
1
vote
2answers
272 views

Selenium screenshots not visible in Robot Framework HTML log file when executing with pabot

I'm having trouble with Selenium screenshots when using pabot to run my tests. They're simply not visible in the HTML log file as seen in the example below (only a dot is appearing) : The HTML log ...
1
vote
1answer
1k views

Selenium Python Bindings - Accessing Submenu Items

I am using Selenium to write unit tests for a website to test scientific software. The backend uses Flask to generate a sidebar where each project is clickable with a dropdown menu. You can only open ...
1
vote
1answer
1k views

How to handle mouse over event on submenu in Internet Explorer - Selenium using Python

I am having a problem using selenium and internet explorer 11. I have to automate a website data gathering project where I have to scrape the website for CSV links and download then automatically ...
1
vote
1answer
587 views

Selenium Python

I'm new to automation testing and decided to use Tumblr as my subject. I'm having trouble making the options appear, see image attached, and don't know what else to use. The code I'm currently trying ...
1
vote
1answer
23k views

How to print all elements using python and selenium

I'm trying to make a code to get all the results from a specific search i do on a website. Unfortunately, I haven't been able to print all the results from the classes i need. Here is my code: #...
1
vote
2answers
1k views

Selenium: how do I download a PDF from a pop-up?

I know this question was probably answered already, but all the answers I found are either old and involve using Selenium APIs that are deprecated, or require a third-party tool, which is overkill for ...
1
vote
3answers
3k views

ElementNotVisibleException when selecting dropdown option

I can't make Select() method working in selenium. I have this code: <select class="print-select menuo selectBox" name="data[gimimo-m]" style="display: none;"> <option class="dis-option" ...
1
vote
1answer
4k views

Iterate Clicking via nested loops? - Python and Selenium

Just a heads up, this is my first post on here so if I violate any of the posting rules please let me know! Currently, I am attempting to : Find WebElements(Hyperlinks) in a Dashboard Table to ...
1
vote
1answer
588 views

Type Error when using DDT for Selenium

I am learning Selenium with python, so please excuse my amateur questions, I am trying to run a simple Data driven test where selenium will enter a few different names on the Name field. The Page ...
1
vote
1answer
269 views

selecting from drop down list using selenium3.0.2 and python3.5.1

This is my first question in OS and I would describe it in details with my best effort. Selenium3.0.2 firefox 45.6.0 geckodriver 0.13.0 python 3.5.1 (with Anaconda 2.4.1 (64bit)) What I want to ...
1
vote
1answer
2k views

Syntax error with a if / else statement (Python / Selenium)

I'my trying to apply an if / else statement in Python to know if I have an element or not and if it is the case, click on it. But I don't know why I have a syntax error and I don't see where I have ...
1
vote
1answer
4k views

Button not clickable with Selenium

I'm having a problem with a Cancel button which can be clicked manually, but fails when I try to get Selenium to click on it. The button is being identified, but when I assert if the button is ...
1
vote
4answers
2k views

How to log out in facebook using python selenium?

I want to know how to log out in facebook using python selenium. here's my code: from selenium import webdriver from selenium.webdriver.common.keys import Keys import time #from selenium folder ...
1
vote
1answer
673 views

What's the difference between using Python vs. Ruby for Browser Automation testing? [closed]

I want to automate test cases on web browsers and I love the concept of Python's Salad (mix of Lettuce (BDD) and Splinter (browser automation)). But I've heard that Salad might not be the most stable,...
1
vote
1answer
1k views

Selenium Webdriver with Python - Unable to click on “Open” or “Save” or “Save as”

I'm a first time learner of Selenium with Python and I'm facing the below issue: When I click on a Download template link in an application, the OS give the User with the options Open or Save or Save ...
1
vote
1answer
1k views

Reporting for Python tests built using PyUnit

I am looking for a good reporting tool for Python tests-specifically the one which supports Python 3.0+, with Selenium, built using the default PyUnit framework. So far I have come across only one ...
1
vote
1answer
50 views

Data type/value of argument checking [closed]

Consider ClassA that has a method that takes an argument, say a string. This method then passes the argument to ClassB to do something with it. Should ClassA be assuring that the argument is valid (...
1
vote
1answer
3k views

Selenium webdriver not recognizing div element

I have found several questions related to this one particular travel website MakeMyTrip, so I tried to automating it. I was successful in selecting the primary details and getting on the Flight ...
1
vote
1answer
6k views

TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given)

I'm new to coding and Python. Not sure where exactly I should be looking to fix this error. from UIMap import tomcat8LoginPage,tomcat8urls,competitors class test_Competitors(unittest): def setup(...
1
vote
1answer
2k views

How to handle widows authentication dialog using webdriver in python

I have an application which is secured by http authentication. So when I open the URL it is looking for user/pass in windows authentication dialog. I wanted handle this dialog to enter user/pass and ...
1
vote
3answers
1k views

Desktop application automation

I need to automate desktop application i.e Bluetooth PTS tool. But can't find any good way to do. I have no exposure to scripting.
1
vote
2answers
2k views

Force selenium to use the portable firefox application

I have installed firefox 14 and has firefox portable version 25.0.1 on the machine, where I run tests for a web site. Due to a limitation in the site I'm testing, I cannot run my tests on firefox 14 ...
1
vote
1answer
1k views

check for value if found before adding it to my drop down list?

i have a drop down list that i add items to it,i ask the user to type in brand name and check first if that brand is already found on the drop down list if yes prints a message if no do some actions. ...
1
vote
1answer
2k views

How can I convince Squish to recognise the menu bar on Mac OS X?

I'm currently recording some python test scripts for a Mac OS X application using Squish for Qt, version 4.0.2. The menu bar of the AUT works fine if interacted with manually, but for some reason ...
1
vote
0answers
35 views

Issue with switching to the new window in Selenium + Python (chromedriver)

I'm having an issue when I try to switch the new opened window. Every time I execute a test case, my chromedriver opens with a window named "data:,". My code: def test_case(self): reg = Register(...
1
vote
1answer
48 views

Selenium WebDriver document.getElementById instead of send_keys

I have the following code driver.find_element_by_id("Element_ID").send_keys(str(sheet.cell(row=r, column=2).value)) Values is taken from excel, but instead send_keys, I want to use document....
1
vote
0answers
32 views

Issue with parallel testing in pytest

So I have two test cases in a map. From command prompt I type "pytest -n 2" then hit Enter. Instead of opening two browsers and execute them in parallel, pytest is opening 4 browsers, but only two of ...
1
vote
2answers
50 views

Are there any good links and references for learning how to create an Appium Python Framework?

Are there any good links and references for learning how to create an Appium Python Framework? There seem to be a lot of Java information out there, but Python seem to have a lot less available ...
1
vote
1answer
236 views

Selenium can't click href

I want to click on a href(all of the delete ones), but can't <a href="#delete"><img height="16px" width="16px" src="/images/icons/trash_16.gif"></a> I've tired (both delete and #...
1
vote
2answers
52 views

Strange drop down automation problem - multiple select

I've tried for days to figure this one out. I have a selector that I can't figure out. It seems to be a regular select statement with multiple options but when clicking one option directly it ...
1
vote
0answers
115 views

Appium 1.10.0 + Android : Unable to accept permission alert

Team, I am facing issues to accept the permission on Android using Appium. I have tried below options: capabilities.SetCapability("autoAcceptAlerts", true); driver.switch_to_alert() driver....
1
vote
0answers
339 views

Attach Existing browser session in SeleniumLibrary RobotFramework

I have an LDAP alert box that pops up as soon as the browser is opened. I am Using Robotframework with the seleniumlibrary for my automation scripts.The issue is that the execution of the script ...
1
vote
0answers
36 views

Testing of console tools

From my previous experience, I am used to write tests for either unit testing or integration/deployment testing. Now I am facing the challenge to write automated tests for a console tool using a ...