selenium-webdriver

How to find elements that do not include a certain class name with selenium and python

橙三吉。 提交于 2020-08-02 16:22:56
问题 I want to find all the elements that contain a certain class name but skip the ones the also contain another class name beside the one that i am searching for I have the element <div class="examplenameA"> and the element <div class="examplenameA examplenameB"> At the moment i am doing this to overcome my problem: items = driver.find_elements_by_class_name('examplenameA') for item in items: cname = item.get_attribute('class') if 'examplenameB' in cname: pass else: rest of code I only want the

How to find elements that do not include a certain class name with selenium and python

柔情痞子 提交于 2020-08-02 16:22:16
问题 I want to find all the elements that contain a certain class name but skip the ones the also contain another class name beside the one that i am searching for I have the element <div class="examplenameA"> and the element <div class="examplenameA examplenameB"> At the moment i am doing this to overcome my problem: items = driver.find_elements_by_class_name('examplenameA') for item in items: cname = item.get_attribute('class') if 'examplenameB' in cname: pass else: rest of code I only want the

How to capture JavaScript errors with Selenium WebDriver using Java

荒凉一梦 提交于 2020-08-02 13:15:51
问题 I was wondering if there is a way to capture JavaScript errors on a page while running automated Selenium tests. 回答1: There is logs Beta version in WebDriver driver.manage().logs().get(LogType.BROWSER); Will give you the console content. Then you can filter it using Level LogEntries entries = driver.manage().logs().get(LogType.BROWSER); entries.filter(Level.SEVERE); 回答2: And there is one that worked for me. Here it is. public boolean isThereJSErrorOnThePage() { Set<String> errorStrings = new

How to scroll to element using Nightwatch?

女生的网名这么多〃 提交于 2020-08-02 06:11:53
问题 I am using nightwatch for e2etesting my app. One of the tests fails because it cannot scroll to the element that it is testing I suspect. Question do I need to scroll or is there another way to do it? This is the element I am testing: return this.waitForElementVisible('#myElement', 4000) //wait for it to be visible .assert.visible('#myElement') .click('#myElement') The element is at the top of the page but the testrunner has scrolled a bit down the page and it is not visible in the screenshot

how to login to the alert window when we navigate to the browser through selenium

和自甴很熟 提交于 2020-07-31 05:52:14
问题 I have the url which needs credentials and I am navigating to that through selenium + Java https://username:password.example.com/ However it still shows the login window but not as an alert window. Attached the screenshot. I tried the below code but it did not work UserAndPassword UP = new UserAndPassword("username","password"); driver.switchTo().alert().authenticateUsing(UP); Is there anyway I can do it? 回答1: You are missing @ symbol after user name and password. You can try like below,

how to login to the alert window when we navigate to the browser through selenium

你离开我真会死。 提交于 2020-07-31 05:51:33
问题 I have the url which needs credentials and I am navigating to that through selenium + Java https://username:password.example.com/ However it still shows the login window but not as an alert window. Attached the screenshot. I tried the below code but it did not work UserAndPassword UP = new UserAndPassword("username","password"); driver.switchTo().alert().authenticateUsing(UP); Is there anyway I can do it? 回答1: You are missing @ symbol after user name and password. You can try like below,

how to login to the alert window when we navigate to the browser through selenium

那年仲夏 提交于 2020-07-31 05:51:03
问题 I have the url which needs credentials and I am navigating to that through selenium + Java https://username:password.example.com/ However it still shows the login window but not as an alert window. Attached the screenshot. I tried the below code but it did not work UserAndPassword UP = new UserAndPassword("username","password"); driver.switchTo().alert().authenticateUsing(UP); Is there anyway I can do it? 回答1: You are missing @ symbol after user name and password. You can try like below,

How to wait until <div> section reload using selenium webdriver?

橙三吉。 提交于 2020-07-31 04:33:05
问题 There are multiple dropdowns in div section. If i select an option in one of the dropdown, then all the other dropdowns loads autmatically without page reload. This is because of only that particular section reloads. Sometimes this loads fast and sometimes slow. How can we set webdriver to wait until this div section reload fully. <div id="Fruits"> ... ... </div> Am using C# Thank you 回答1: We can wait until div section have any sub section or child node. WebDriverWait wait = new WebDriverWait

Chromedriver versions are labelled differently in chromium website and maven repository. Which one to consider for chromedriver?

旧街凉风 提交于 2020-07-31 04:01:15
问题 I see chromedriver is available on https://sites.google.com/a/chromium.org/chromedriver/ and also on https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver. However the versions are different in both cases. In chromium website, it is mentioned as Current stable release: ChromeDriver 84.0.4147.30 In maven repository, it is mentioned as 4.0.0-alpha-6 as latest artifact. Question: What is the difference between both and which one should be included as a project

Chromedriver versions are labelled differently in chromium website and maven repository. Which one to consider for chromedriver?

╄→гoц情女王★ 提交于 2020-07-31 04:00:33
问题 I see chromedriver is available on https://sites.google.com/a/chromium.org/chromedriver/ and also on https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver. However the versions are different in both cases. In chromium website, it is mentioned as Current stable release: ChromeDriver 84.0.4147.30 In maven repository, it is mentioned as 4.0.0-alpha-6 as latest artifact. Question: What is the difference between both and which one should be included as a project