selenium

object has no attribute 'assertEqual'

醉酒当歌 提交于 2021-01-28 01:03:10
问题 Getting object has no attribute 'assertEqual' when I try to use the below statement in my code: self.assertEqual("IRELAND INSTITUTE OF PITTSBURGH", driver.find_element_by_id("cname").get_attribute("value")) This works fine when I use in my test case instead. I understand that it is a good practice to put asserts in the test case. But I would like to understand why this piece of code cannot work in the page instead if we are following page object pattern 回答1: assertEqual is a method that

Selenium Python Using find elements how do i get the text value of each element

非 Y 不嫁゛ 提交于 2021-01-27 23:43:58
问题 I am using Selenium Webdriver with Python. I have a search results page which displays a list of products. I want to loop through the list and print out the text value of the h2 tag. E.g. it should print out F1 2015 (PS4) I know i should use self.driver_find_elements to get all the elements into a list. I should then use a for loop to iterate through and print out it's value. My code is not working. It prints out a list of the representation of the object. It does not print out F1 2015 (PS4)

入行4年,跳槽2次,我摸透了软件测试这一行!

心已入冬 提交于 2021-01-27 22:27:17
最近几年软件测试行业在如火如荼的发展壮大,互联网以及其他传统公司都需要大批量的软件测试人员,但是20年的疫情导致大规模裁员,让人觉得行业寒冬已来,软件测试人员的职业规划值得我们深度思考。 大家都比较看好软件测试行业,只是因为表面上看起来:钱多事少加班少。其实这个都是针对个人运气好的童鞋才会有此待遇。 在不同的阶段做好不同阶段的事情,才有可能离这个目标更近,作为一枚软件测试人员,也许下面才是我们最真实的写照。 第一年 当年也是一头撞进了软件测试行业。迫切的想要了解这个行业,它的升职模式,如何才能薪资更高。但是以过来人的经历,告诉你:做好当前的事情。把上司交给你的每一份任务都仔细认真的去完成,体现你作为一个初入职场的新人的价值。新人进去,不奢望你能够做多大的贡献,只希望交代给你的事情,不用给你擦屁股就行。 第一年,如果你每天都很积极,迫切的想要完成更多的任务,那么这一年的你将会进步最快。对功能业务逻辑的整体把握感,对测试用例的编写能力,对功能测试进度把握,这些都将会成为你以后工作的坚实基础。这一年,请打好你的基础,暂时忘记自动化代码工具这些,你没有坚实的软件测试行业内知识和接触到的一些专业名词,你拿着工具也都是徒然。 第二年 经过第一年的努力,你已经具有比较牢靠的软件测试基础,已经完成了一轮一轮的重复的手工测试,对,在这个阶段我们应该做什么

How to extract the text of the firstselectedoption from a dropdown using Selenium Webdriver through Java

半城伤御伤魂 提交于 2021-01-27 22:10:50
问题 After selecting an option from drop-down. I am trying to get that option displayed in the console. below is my code. But I get "//[[[[ChromeDriver: chrome on WINDOWS (d5a01776981da5dacfeb89dbbc2e6b52)] -> xpath: //*[@name='airline']]].// -> tag name: option]" The tag name is option for dropdown options. I have tried all solutions of selectByXXXX. but nothing seems to work. what would be the right code ? //airline preference { Select airline = new Select (driver.find Element(By.name("airline")

Automate Dropdown Menu in Selenium Without Select

巧了我就是萌 提交于 2021-01-27 21:56:29
问题 I'm trying to select an element from a dropdown using Selenium. I'm already able to select the dropdown, but I don't know how to select the specific elements from the dropdown, since the website doesn't use select and thus I can't use the built-in select class. For reference, this is the HTML for one of the elements in the dropdown. <div class="Di ljb1sb hIqB1e LMgvRb" jsname="wQNmvb" jsaction="" data-value="118237948356370773614" aria-selected="true" role="option" tabindex="0"> <div class=

Perl and Selenium::Remote::Driver

China☆狼群 提交于 2021-01-27 21:30:21
问题 EDITED AGAIN I have a server on AWS somewhere in Northern Virginia and this is my monitoring server. I ssh into this Ubuntu server from another State to do system administration. I want to do web automation tests on this server which will test a web application on the Internet hitting a URL and verify that I can selenium test a login and authenticate successfully. This server is on an AWS cloud I'm not quite sure which Perl module to use since I'm accessing it remotely. There are two CPAN

Selenium only returns an empty list

余生颓废 提交于 2021-01-27 20:51:22
问题 I'm trying to scrape football team names from betfair.com and no matter what, it returs an empty list. This is what I've tried most recently. from selenium import webdriver import pandas as pd driver = webdriver.Chrome(r'C:\Users\Tom\Desktop\chromedriver\chromedriver.exe') driver.get('https://www.betfair.com/exchange/plus/football') team = driver.find_elements_by_xpath('//*[@id="main-wrapper"]/div/div[2]/div/ui-view/div/div/div/div/div[1]/div/div[1]/bf-super-coupon/main/ng-include[3]/section

Play Framework: Run single selenium test on the command line (headless browser)

落爺英雄遲暮 提交于 2021-01-27 20:30:28
问题 I can run a single selenium test in play's browser UI, however, is it possible to execute a play selenium test on the command line? Obviously if I run play auto-test it will execute all my selenium tests (as well as my junit tests). Is there a way that I could tell Play to execute just a single selenium test on the command line to check whether it works using the headless browser? 回答1: I don't think it's possible to do so with the current play framework, but see how auto-test works on https:/

How to get the length of the <li> elements in an <ol> with Selenium in Python?

你离开我真会死。 提交于 2021-01-27 20:22:40
问题 I have an <ol> list in my HTML like the following: <ol id="search-results"> <li class="foo">-</li> <li class="foo">-</li> <li class="foo">-</li> <li class="foo">-</li> </ol> What I need to do is to verify that the <ol> list contains <li> items within, ie. a search query comes up with actual results. My current code is as follows: search_field = driver.find_element(By.NAME, 'query') search_field.send_keys('Foo') search_field.submit() results_list = driver.find_element(By.ID, 'search-results')

Selenium GeckoDriver is slow to launch Firefox Browser

心已入冬 提交于 2021-01-27 20:18:08
问题 I have recently been trying to get a Selenium environment up and running again. Everything works as it should with scripts executing as they should, using different web drivers etc etc. However, the initial launch of each driver takes anywhere between 2-5 min to launch. This makes it a pain to develop and troubleshoot my scripts. I use Python 3.6 with PyCharm and Selenium installed with pip. The same issue is present with Python 2.7. Things I have tried so far (without success): Reinstalled