Posts

Showing posts with the label selenium

Selenium and Java: How do I get all of the text after a WebElement

Image
Selenium and Java: How do I get all of the text after a WebElement I am coding a program in Java using WebDriver and am having a little bit of trouble getting the text after the select webElement. The HTML code for the part of the website that I want is as follows: <div id="content"> <div id="Pagination"></div> <div id="mid"> </div> </div> The textbox class codes for a search bar and a drop down bar of languages My Java code is currently able to open chrome using the chrome driver and is able to type into the search bar. I am however not able to get the text that results from the entry. Image In the image here, I entered "avoir" into the search bar, and I want all of the text inside the boxes after which do not seem to have any id's or names to be used inside the xpath. Can someone please help me in finding how to get and save the text from those fields after the dropdown l...

Getting error : org.openqa.selenium.WebDriverException: unknown error: keys should be a string

Getting error : org.openqa.selenium.WebDriverException: unknown error: keys should be a string I am getting the error to access the data from the properties file in my selenium UI : How can this be solved ? org.openqa.selenium.WebDriverException: unknown error: keys should be a string. I have the following framework. I made it for my self for ease, looks like complicating myself. If any good ideas to better it, please suggest. Appreciate all suggestions. Framework contains the following : 1. config properties file 2. utilities class 3. Page elements definition class file 4. reusable functions class file 5. test classes config.properties file has the following content : config.properties url=http://some.com Email=someuser Password=somepassword Utilities class ( BrowserCalls ) the following code : BrowserCalls import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import ja...

PyQt QProgressBar not working when I use it with Selenuim

PyQt QProgressBar not working when I use it with Selenuim I built a PyQt5 GUI to do some Selenium testing. Everything works as expected, except for the PyQt progress bar. In the first example below, where I use the Selenium browser, the progress bar just jumps to 100%, at the end, when the browser closes. But, the Selenium works as expected. def test(self): self.completed = 0 browser = webdriver.Firefox() links = ['http://www.somesite.com/', 'http://www.somesite.com/page2', 'http://www.somesite.com/page3'] for link in links: browser.get(link) self.completed += 100 / len(links) time.sleep(2) print(link) self.progressBar.setValue(self.completed) browser.close() But, in this version below, with the Selenium browser commented out, the progress bar works as expected. def test(self): self.completed = 0 #browser = webdriver.Firefox() ...