Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

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

1
vote
2answers
12 views

Recommended project structure for Pywinauto project

I'm used to Selenium and the page object pattern. I'm now moving to an automation project for a Windows app, so I'm discovering Pywinauto. I've be looking for good practices and was expecting ...
0
votes
1answer
26 views

Python Selenium - How to get the “Close” text to click on this button error -Unable to locate element

This is the HTML <button type="button" class="d-block p-3 mx-auto btn btn-danger btn-lg xh-highlight"> <i class="fa fa-close mr-1"> </i> Close </button> And I'm trying with: ...
2
votes
1answer
26 views

Selenium Python queston: How to extract the dynamic id generated?

I have a link inside a table with a dynamically changing id, the xpath being: //*[@id="1544727471470-1-uiGrid-0007-cell"]/a/span/span To its left is a checkbox with xpath: //*[@id="1544727471470-1-...
0
votes
0answers
29 views

Selenium eBay automation

input from selenium import webdriver from selenium.webdriver.common.keys import Keys def main(): Itemvar1 = input("prompt") driver = webdriver.Chrome(executable_path=r'C:\Users\Michelle\Downloads\...
0
votes
1answer
31 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
1answer
31 views

How do you press two keys at the same time with Python Selenium?

Trying to do accessibility automation and want to use shift+tab to go back an element. But can't seem to get anything to work. Tried what the doc imply should work based off their "Example, pressing ...
0
votes
0answers
31 views

What's the maximum number of Selenium webdriver Firefox instances?

I'm working in a project using high number of browser instances. So I'm wondering, what's the maximum number of Selenium webdriver instances for Firefox. Need to say I can control a virtual machine ...
1
vote
1answer
33 views

Python Selenium: Unable to locate element

I'd like to download the primary parcel layer from this website. First step is to click the "Add/Remove Item" button, but I am having trouble locating it. For this button, the Inspect Element window ...
0
votes
1answer
19 views

How to change the pip version in pycharm

In pycharm the pip version is showing as 10.1 but when i check the pip version in my CMD it is showing as 9.0.1. I am not able to understand why it is happening. If any one know the reason can you ...
0
votes
0answers
21 views

Unable to select fields in Selenium/Python 3.7

I know how ridiculous this sounds, as this isn't my first time automating anything, but for some reason I'm having a hard time here. The issue is just on this site and with Chrome. This works in ...
1
vote
2answers
39 views

How to call rest API using python selenium?

I have a scenario where I need to call a rest API in my python selenium script but I am not sure how to do it. If anyone as idea on it can you please help me out . The API used is to delete the ...
0
votes
2answers
27 views

Selenium: Why find_element_by_partial_link_text finds the first match only?

What I want to do: I want to click all the links where partial text = "105611A5C7B9_Logs_" Example: First Link Text = 105611A5C7B9_Logs_11-15-18-06-04PM.tgz Second Link Text = ...
1
vote
1answer
46 views

How do you automate an OTP using python selenium?

I have a scenario where I need to perform a login, but the problem is its based on OPT (I mean once I enter a phone number to that number I receive an OTP That OTP is the password)
0
votes
1answer
31 views

How does starred expression works when using with find_element() method

def enter_text_textbox(self, locator, text): ele = self.driver.find_element(*locator) try: logging.info("# Entering text in Textbox.") ele.clear() ele.send_keys(text) ...
0
votes
0answers
19 views

Is local storage not persisted when using remote WebDriver?

Initial setup setUpClass creates a remote webdriver instance (because I don't want the overhead of creating a browser session per test) using Chrome, goes to the login page, enters credentials and ...
1
vote
2answers
56 views

To work with two different drop downs which are dependent on each other

I have a scenario in which i am finding bit difficult to automate . The test scenario is : There are two drop down . 1.To select the state. 2.To select the respective cities. So i need to write a ...
1
vote
1answer
41 views

Is there a way to check the font style , colour , size etc using selenium python

I wanted to know how to write test scripts to test font style, color, size etc using python selenium if anyone of you knows can you please share me the appropriate links. ('i mean study material links'...
0
votes
1answer
33 views

Call Python class in JMeter

How can I call python class in JMeter to test the performance of the python code as we do in java by importing jar file and write a script in BeanShell?
0
votes
2answers
47 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
43 views

Selenium Python - Unable to find an element, get stale element exception when using element locator

Scenario: 1.Login to a website using script and navigate to the Home page. 2. On the home page, click a link and navigate to a new page. 3. Then navigate back to the home page using the top navigation ...
3
votes
1answer
334 views

Can't drag and drop from source to target using selenium and python

I am trying to drag and drop using Python and Selenium. I have two containers with rows which indicate file names and by drag and drop, I want to transfer one file from the first container to the ...
0
votes
2answers
82 views

Python expected an intended block error if/else [closed]

Hello im getting in this script an indentationError time.sleep(3) driver.find_element_by_id("mainMenuRoutes").click() time.sleep(1) time.sleep(2) if driver.find_element_by_xpath('//*[@class="m-btn ...
0
votes
3answers
135 views

Python Selenium Find Button

I have a Website were I want to click a button, but I can't find in the button in the HTML script, what I have to write in my Python script? Later I want to have something like driver....
0
votes
0answers
29 views

Email Verification

I want to make steam Accounts in bulk and need email verification. How would I login into POP3 & confirm the email? I'm just looking for it, What code should I start since many on the web are ...
0
votes
2answers
57 views

SyntaxError: invalid syntax // SyntaxError: unexpected EOF while parsing

How do I detect text inside of this, this is HTML & this is XPath. I tried HTML <span class="messageText">Hello.</span> XPath //*[@id="liveAgentChatLogText"]/span[22]/span[2] ...
0
votes
1answer
161 views

Selenium XPath Invalid Syntax [duplicate]

element = wait.until(EC.presence_of_element_located((By.XPATH, '//*[@id="liveAgentChatLogText"]//*[contains(string(.), "THE_TEXT_STRING_I_AM_LOOKING_FOR")]') driver.find_element_by_xpath('//*[@id="...
0
votes
1answer
43 views

Running test suite from both terminal using pytest and unittest runner but show only unittest runner results and execute once

i am trying to execute my following test suite: import unittest from Login_Page import LoginPageAndLogout def test_suite(): # get all tests from classes login_test = unittest.TestLoader()....
3
votes
2answers
249 views

Fetch all the links on a page that are within the same class

Quick Links <span class="buttonContainer"><input type="image" class="helpButton" src="/images/buttons/btn_help.gif" alt="View help." title="View help."><input type="image"...
0
votes
1answer
113 views

How to run Robotframework test cases in a particular order from different suites?

We have at least ten test suites each having at least 10 test cases. I would like to know if there is a way to run selected tests from each of the suites in an order I would like? For example with ...
-1
votes
1answer
49 views

Pop up handling in Selenium using try and except block gives a broad exception warning

try: if browser.find_element_by_xpath('//[@id="s"]/a').is_displayed(): browser.find_element_by_xpath('//*[@id="s"]/a').click() browser.switch_to.default_content() ...
0
votes
1answer
4k views

ElementNotVisibleException: Message: element not visible Selenium in Python

I'm trying to click an options from a website dropdown menu but I am not able to click. I am using "xpath" locators for the element and I upgraded my chrome to the latest version for chromedriver. ...
0
votes
1answer
76 views

Unable to capture the alert in Selenium using Python

I am trying to test a web portal using Selenium and Python. The problem is, I am unable to get around an error, in other words, I am unable to catch the alert. Scenario: Search for a user, if the ...
2
votes
1answer
52 views

Selecting usernames from a list using selenium

This is the code I have used so far: username = browser.find_element_by_id("field67041336") email = browser.find_element_by_id("field67041337") mobile = browser.find_element_by_id("field67041338") ...
1
vote
1answer
122 views

How to properly mock dependencies

My code is organized as several independent classes. Each dependency is injected by a setter, so in the end I create instances of classes B and C, set their parameters and inject them to class A. Now ...
0
votes
1answer
35 views

Unit testing for chains of generators in Python

I want to write unit tests for methods that take a generator as input and produce a generator. I am building on this answer. For this question let's take the method: def candidates_for_deletion(self,...
0
votes
1answer
132 views

How to make while loop for example 5 automatic registration account

How to make while loop for example 5 automatic registration account this is my code and I want to make an automatic python script for 5 registration account from selenium import webdriver driver = ...
0
votes
0answers
44 views

selenium element.text() different on two different computers

What would make element.text() give different outputs on two different computers? I wrote a scraper with python and used pyinstaller to make it into a .exe file. I am using the same file on each ...
0
votes
1answer
2k views

How do I use find_elements_by_xpath to only get some elements in python selenium?

How should I use driver.find_elements_by_xpath() to get all the data-row elements that I boxed in the picture. I do not need the other tr tags. In my current code I just check all the tr tags and ...
0
votes
1answer
435 views

Does implicitIwait affect set_page_load_timeout python, selenium, chrome driver

I have a scraper where I have: driver.set_page_load_timeout(30) and driver.implicitly_wait(10) Does implicit wait affect the driver.get() call? I was wondering if my 10 second implicit wait ...
0
votes
0answers
30 views

How to write two value in same row csv with python

I have two informations (number of men and number of women) and I would like to store them in the same row of the csv named (population): nb_femme=soup.find_all("text", {"class" : "...
1
vote
1answer
457 views

How do I remove unnecessary console message pop up using selenium with Python?

When I used Chromedriver with selenium in python, I get a lot of console messages that are not useful to me and that don't affect my scraper. How do I not output these? I do not have this issue when I ...
0
votes
1answer
28 views

How to test a class that wraps methods connect to a remote database

I wrote a class creating connection to a remote database, query and do some more actions on that. Which is the best way/ strategy to test that kind of class? I tried to mock third party functions ...
0
votes
0answers
31 views

Test Impact Analysis tool for Python

Is there a Test Impact Analysis (TIA) framework/tool/extension for Python? E.g. an equivalent to JAVAs Test Impact Analysis Plugin for jQAssistant?
0
votes
0answers
52 views

Architecture unit testing for Python?

Is there an equivalent to the JAVA architecture unit test framework ArchUnit for Python?
0
votes
0answers
295 views

Selenium web driver issue with Action Chains drag drop when native functions work fine

While trying to automate using Selenium webdriver and python I am facing the following issue: Simple click is working without action chains class: element.click() But trying to click is not working ...
0
votes
2answers
1k views

Can't find any element using CSS selector with Selenium on Python

I'm running a script on vodafone.co.uk but I can't find any element using the CSS Selector. browser.get("http://freesim.vodafone.co.uk/") browser.find_element_by_css_selector("#frmNew > div:nth-...
1
vote
1answer
141 views

What Python tool support automation of Sciter based desktop application

I have been using pywinauto for automation of desktop application. This tool was fine until we started using Sciter (see https://sciter.com for more info) on some screens. Pywinauto supports Win32 API,...
0
votes
0answers
45 views

Run a selenium script on selecting the script from a multi-select in django

on a webpage there is a multi-select drop-down, once user selects any option from the drop-down, the required selenium script must run. index.html <div class="form-group"> <label class="...
1
vote
1answer
3k 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....
0
votes
0answers
26 views

How can I make the login page methods static for selenium scripts?

Below is my code for my login page, I tried to make these methods @staticmethod, I tried to do the same by adding the @staticmethod syntax , but the problem is , after that i cant access self.driver ...