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
2
votes
1answer
139 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-...
1
vote
1answer
440 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 ...
0
votes
2answers
2k views

Want to click on last button in row in python selenium

I need to click on the last button (CurrentPageUp) in a row. xPath does not work since nr of buttons change frequently. I tried find_element_by_xpath('//*[@id="ShowProducts_PagesTop"]/span/button[...
1
vote
1answer
947 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
143 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 ...
1
vote
2answers
345 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
363 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 = ...
0
votes
1answer
43 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) ...
1
vote
1answer
216 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
258 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 = ...
4
votes
1answer
7k views

How to handle a native OS (Ubuntu) file upload window in selenium webdriver with python?

This is my first time here but I have already posted this question on SO. I keep getting solutions for Windows + Java and not for Linux or python for that matter. I am using Selenium and Python to ...
0
votes
0answers
148 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 ...
2
votes
1answer
739 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'...
4
votes
4answers
31k views

How to make a selection from a dropdown using Selenium/Python

I've been trying to make a selection from a drop down but cannot seem to figure out how. Here's what I'm trying to get: <div id="quote-status" class="panel panel-default"> <div class="...
4
votes
2answers
2k views

python unittest trying to run setUpclass

I am on a website where you login, then search for course, click on course and then it lands on the Credit card page, since its just one course and is common and I am just trying to run DDT on CC ...
0
votes
1answer
31 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 ...
5
votes
1answer
7k views

Try Assert Exceptions not failing test in python unittest or better way to loop through failures

Okay I am running Chromedriver test that gathers console logs and then tests an assertion against pythons unittest. class ConsoleLogsTest(unittest.TestCase): @classmethod def setUpClass(cls)...
6
votes
4answers
9k views

Running Selenium tests as a scheduled task

I'm trying to run a Selenium WebDriver script written in Python on a Windows 7 64-bit box as a scheduled task. The test works pretty well when run as a batch file from the command prompt, but when ...
2
votes
1answer
588 views

Running python selenium test as suite

I have a simple test suite defined as below from unittest import TestLoader, TestSuite, TextTestRunner from TestScripts.LogOn import test_1 from TestScripts.FirstLog import test_2 if __name__ == "...
3
votes
1answer
2k 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
214 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 ...
13
votes
4answers
26k views

How to clear localStorage using selenium and webdriver

I want to call localStorage.clear() before running a group of specific tests but the thing is I don't know how. I can see CLEAR_LOCAL_STORAGE variable mentioned here but still failing to understand ...
0
votes
1answer
536 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
143 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()....
2
votes
1answer
55 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") ...
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. ...
-1
votes
3answers
5k views

How to Iterate and loop the select Options in dropdown box using Selenium with python?

I want to select an apple and then after "save and Go" then after it should select an orange like the way it should iterate till coconut, at end of the list it should be select 'Save & Hold'. I ...
6
votes
16answers
46k views

Should I learn Python or Java to get into test automation? I am new to programming

Should I learn Python or Java to get into test automation? I'm new to programming. Please share your thoughts or links to any useful information.
-1
votes
1answer
56 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
2answers
287 views

Need To Copy Source Code of CMS Page in Python Webdriver

I am new to selenium 2.53.6 and Chrome webdriver so I may have overlooked something very simple. I need to copy the source code of a CMS page in Python 3.3.6 webdriver. I have tried page_source ...
0
votes
5answers
5k views

Selenium - advantages and disadvantages of using Python vs C#

We currently have two teams. An automation team and also a web testing team. The automation team currently use Selenium and C# to automate tests on our web applications and legacy systems. As a ...
4
votes
4answers
18k views

How to set browser locale with chromedriver (Python)

I am trying to set my browser locale by doing the following options = webdriver.ChromeOptions() options.add_argument('--lang=es') driver = webdriver.Chrome(executable_path=driver_location, ...
5
votes
1answer
1k views

How to retrieve httponly cookies with IE selenium driver?

By my research so far, IE selenium webdriver (for IE10 or 11) is not able to retrieve httponly cookies. So code like this can return a full set of cookies including those set to httponly if I am ...
0
votes
1answer
6k 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
264 views

Performance issue - Robot Framework vs Python

I am currently working on the development of a keyword that allows to separate the contents of a text file into 2 parts and create 2 new files containing each of these 2 parts. The file format is ...
1
vote
1answer
2k 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 ...
1
vote
1answer
222 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,...
1
vote
0answers
266 views

how to plot multiple locations in google.map using flask [closed]

i'm traying to showing multiple points in map from a csv file named 'likibularochelle_test.csv' this file contains 866 points with latitude and longitude but i can't view all of this points just 33 as ...
-2
votes
2answers
559 views

How to Handle checkboxes in Selenium with Python?

There are 7 unselected check-boxes available in application. How to select first and last checkboxes and how to select all checkboxes from reverse order using python selenium webdriver?
0
votes
1answer
75 views

Get certain text from website using Selenium

I'm trying to copy a certain string of a website's source code using selenium. This is the page's source code: <body data-gr-c-s-loaded="true">{"url":"https:\/\/shop.website.com\/cart\/...
0
votes
1answer
490 views

Python stops after opening webdriver

from selenium import webdriver driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") driver.get("https://www.google.com/") Hello, I am new to selenium and i have ...
1
vote
1answer
38 views

How do I put validations or assertions in choosing the particular file format?

I am using Robot Framework with Python and Selenium. I need to verify that files have the correct format: specifically that they are image files (e.g.: .jpg, .jpeg, etc). How do I use validations or ...
0
votes
3answers
11k views

ElementNotVisibleException: Message: element not visible

I've seen this error everywhere, but none of the solutions have seemed to work. This is my code: contpayment = driver.find_element_by_class_name('nsg-bg--nike-orange') contpayment.click() Python/...
0
votes
1answer
696 views

Error while executing javascript code in python3 while using selenium

I was trying to remove the ad and other pop-up using selenium after opening the webpage. The pop-up is getting removed but the ad is not getting removed. There is some error in executing javascript ...
0
votes
1answer
269 views

Automation Testing the python code for Autonomous Driving Environment?

I am newbie to testing world. I am currently working on automation testing for a python code in the environment of Autonomous Car Company, is Robot Framework suitable for that? else which is the best ...
1
vote
1answer
3k views

How can I access the http headers using python and selenium?

I have a complex javascript-intensive application I wish for which I wish to use python and selenium for automated testing. However, at the same time I need to have access to the http headers for ...
1
vote
1answer
21k 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
13k views

ROBOT FRAMEWORK: [Error] Parsing ___.robot failed: Data source does not exist

I just setup Robot Framework yesterday. I went to youtube to see some videos on how to set up and I found one that was just uploaded last month. I follow all the steps and I numbered it below. ...
1
vote
1answer
908 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
votes
2answers
1k views

How can I copy and paste part of a split URL using Selenium and Python

I have split URL, and I need to copy and paste a part of that split URL. It gives me an error when I use send_keys method: url_parts[4].send_keys(Keys.CONTROL, 'c') AttributeError: 'str' object has ...