selenium

How to use ext-gen ID generated by EXTJS in Selenium?

假如想象 提交于 2021-02-19 04:02:26
问题 While test automating a web application, I get dynamically generated ext-gen IDs. I tried using xpath but the test cases are failing. I went through different websites but did not find any luck. Can somebody help me? Thank you, Srinivas Marthi 回答1: For automated testing, the auto-generated ID-s of ExtJS are best avoided altogether. You can assign your own static ID-s to components, but now you are basically littering your code with global variables, not good either. Using some ID-s might be a

Python Selenium: Unable to scroll inside iframe

三世轮回 提交于 2021-02-19 04:01:27
问题 Hi, I am able to switch between tabs, access all elements. I am unable to scroll in this iframe. Please help. Code I am using is as follows. iframe = self.browser.find_elements_by_tag_name('iframe')[0] self.browser.switch_to_frame(iframe) # Iterating through tabs for tab_name in soup.find_all('md-dummy-tab'): return_dict[tab_name.text] = [] tab_names.append(tab_name.text) # clicking on tabs one by one self.force_click('xpath=/html/body/div/md-content/md-tabs/md-tabs-wrapper/md-tabs-canvas/md

Python Selenium: Unable to scroll inside iframe

青春壹個敷衍的年華 提交于 2021-02-19 04:01:11
问题 Hi, I am able to switch between tabs, access all elements. I am unable to scroll in this iframe. Please help. Code I am using is as follows. iframe = self.browser.find_elements_by_tag_name('iframe')[0] self.browser.switch_to_frame(iframe) # Iterating through tabs for tab_name in soup.find_all('md-dummy-tab'): return_dict[tab_name.text] = [] tab_names.append(tab_name.text) # clicking on tabs one by one self.force_click('xpath=/html/body/div/md-content/md-tabs/md-tabs-wrapper/md-tabs-canvas/md

Close a newly opened tab or window in Selenium IDE

↘锁芯ラ 提交于 2021-02-19 03:28:13
问题 Using Selenium IDE with Windows7 and Firefox, an automatic click on a link may produce either a new tab or a new window. close() closes the original window or tab, not the new one. Maybe if I had the ID of the newly created one I could select it and then close it but I don't know how to do this automatically. I've asked on the Selenium forum and read the questions here, but they focus on WebDriver, not the IDE. Any help would be appreciated! Stig 回答1: I had same problem and found a solution:

Selenium: Iterate Through Element List

纵饮孤独 提交于 2021-02-19 03:11:12
问题 I am using XPath/CSS and Selenium to locate elements on website. I want to create a method where I iterate through a list of locators (XPath / CSS) and program chooses whichever one works. In other words, it begins with locator one - if the locator is present it returns true and exists the loop. Otherwise it moves on to the next locator in list. Once it exhausts all CSS locators it moves on to XPath and so on. Currently, I am thinking of implementing this as follows: public boolean iterate

Python proxy authentication through Selenium chromedriver

青春壹個敷衍的年華 提交于 2021-02-19 03:10:18
问题 We tried for a few days to setup Proxy Authentication with selenium chromedriver in Python. We couldn't set ip up because Chrome throws a pop-up for authentication. Problem is that selenium can't switch to that window and so, can't type. The only solution that worked for us was using pyautogui which is a bad solution for us because we want to use the headless function. Here are all the methods we tried: driver.switch_to_window() driver.switch_to_active_element() driver.switch_to_alert()

Python proxy authentication through Selenium chromedriver

痞子三分冷 提交于 2021-02-19 03:06:10
问题 We tried for a few days to setup Proxy Authentication with selenium chromedriver in Python. We couldn't set ip up because Chrome throws a pop-up for authentication. Problem is that selenium can't switch to that window and so, can't type. The only solution that worked for us was using pyautogui which is a bad solution for us because we want to use the headless function. Here are all the methods we tried: driver.switch_to_window() driver.switch_to_active_element() driver.switch_to_alert()

In python, selenium, how do I set the error messages for a wait?

北战南征 提交于 2021-02-19 02:47:10
问题 I have the following code: WebDriverWait(self.driver, 20).until(expected_conditions.element_to_be_clickable(click)) Now this sometimes fails and I know why it fails. But the error gives me TimeoutException: Message: Which is useless. Can I possibly set this message? 回答1: You don't have to try/except or wrap anything; message is just an argument of the until() method. WebDriverWait(self.driver, 20).until( expected_conditions.element_to_be_clickable(click), message='My custom message.', ) This

How to address the error EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute using Selenium and Python

会有一股神秘感。 提交于 2021-02-19 01:24:39
问题 I'm getting random error messages from selenium, even though none of them are related to the exact web driver commands I'm running (not that I know of). This error isn't interrupting the program, it's just adding unwanted alerts (making my prints harder to read). Chrome version: 75.0.3770.100 (Official Build) (64-bit) Python version: 3.6.1 ChromeDriver version: 75.0.3770.140 I've added the following code already but I'm still getting the error. options.add_argument("--log-level=3") Error: gl

Selenium test in Internet Explorer in InPrivate mode

强颜欢笑 提交于 2021-02-18 22:11:12
问题 Is there any way how to run Selenium automation test in Internet Explorer 9 in InPrivate mode with IEDriverServer? I need to test 2 (two) testcases: 1. browser is closed. Open one window of IE InPrivate mode. Run test. 2. browser is opened in normal mode. Open new window of IE InPrivate mode. Run test. How should JAVA code look for this tests? Thank you 回答1: public void openBrowserInPrivacyMode(boolean isBrowserActive) { System.setProperty("webdriver.ie.driver", "path/to/IEDriverServer_x32