selenium-webdriver

Protractor: what's the difference between ignoreSynchronization and async/await in Protractor

徘徊边缘 提交于 2021-02-10 06:19:15
问题 I am new in Protractor. And I am doing tests to be familiar with it. Here, I met a problem what I cannot distinguish between ignoreSynchronization and async/await method. I had 3 blocks to test them. The first is clear with protractor's own async features. it('without await and ignoreSynchronization', async function() { await browser.waitForAngularEnabled(false); await browser.driver.get('https://www.baidu.com'); console.log('1'); element(by.css('#kw')).sendKeys('protractor').then(() => {

python selenium unable to select element

青春壹個敷衍的年華 提交于 2021-02-10 05:40:37
问题 I'm trying to select below element in a webpage. .active > b:nth-child(1) This is my code : timbro = browser.find_element_by_css_selector('.active > b:nth-child(1)') hover = ActionChains(browser).move_to_element(timbro) hover.perform() This is part of the error I'm getting: Message: Unable to locate element: {"method":"css selector","selector":".active > b:nth-child(1)"}" what I'm trying to do is activate a drop down menu so that I can click on another link. HTML Snippet: <li> <a href="#nogo"

Selenium Java: I want to access first div element inside a div class

余生长醉 提交于 2021-02-10 05:28:09
问题 Selenium Java: I want to access first div element inside a div class public int checkLinks() { int x = driver.findElements(By.xpath("//div[@class='recommendation-header-social-container']/div")).size(); List<WebElement> y = driver.findElements(By.xpath("//div[@class='recommendation-header-social-container']/div")); int i=0; for(WebElement element:y) { String btn=element.findElement(By.xpath("//div[@class='recommendation-header-social-container']")).getAttribute("innerHTML"); System.out

Selenium Java: I want to access first div element inside a div class

冷暖自知 提交于 2021-02-10 05:25:10
问题 Selenium Java: I want to access first div element inside a div class public int checkLinks() { int x = driver.findElements(By.xpath("//div[@class='recommendation-header-social-container']/div")).size(); List<WebElement> y = driver.findElements(By.xpath("//div[@class='recommendation-header-social-container']/div")); int i=0; for(WebElement element:y) { String btn=element.findElement(By.xpath("//div[@class='recommendation-header-social-container']")).getAttribute("innerHTML"); System.out

Reading title tag in svg?

和自甴很熟 提交于 2021-02-10 05:19:30
问题 How do I read the text in below? svg seems to be a special case. Tried the below, but of no help //*[name()='svg']/title //*[name()='svg' and @title='Test'] //*[name()='svg' and contains(@title,'Test')] <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 137 125" version="1.1"> <title>Test</title> <desc>Created with Sketch.</desc> 回答1: To extract the text from the <title> tag within the svg WebElement you can use either of the following Locator Strategies: Using

How to do Mouse hover on Image in selenium web driver to get menu list

你离开我真会死。 提交于 2021-02-10 03:20:54
问题 I am trying to mouse hover on image to display menu list. My HTML code is: <img id="logo" src="/web/images/header/img_Logo_Topbar.png"> But I am trying Xpath as "//*[@id='logo']" . There is no response. I am using this script: Actions a1 = new Actions(driver); a1.moveToElement(driver.findElement(By.xpath("//*[@id='logo']"))) .build() .perform(); Thread.sleep(1000L); 回答1: It's looks like a bug, I'm not sure what is the solution for this but if you want alternate solution to perform mouse hover

How to do Mouse hover on Image in selenium web driver to get menu list

佐手、 提交于 2021-02-10 03:07:24
问题 I am trying to mouse hover on image to display menu list. My HTML code is: <img id="logo" src="/web/images/header/img_Logo_Topbar.png"> But I am trying Xpath as "//*[@id='logo']" . There is no response. I am using this script: Actions a1 = new Actions(driver); a1.moveToElement(driver.findElement(By.xpath("//*[@id='logo']"))) .build() .perform(); Thread.sleep(1000L); 回答1: It's looks like a bug, I'm not sure what is the solution for this but if you want alternate solution to perform mouse hover

How to do Mouse hover on Image in selenium web driver to get menu list

会有一股神秘感。 提交于 2021-02-10 03:06:21
问题 I am trying to mouse hover on image to display menu list. My HTML code is: <img id="logo" src="/web/images/header/img_Logo_Topbar.png"> But I am trying Xpath as "//*[@id='logo']" . There is no response. I am using this script: Actions a1 = new Actions(driver); a1.moveToElement(driver.findElement(By.xpath("//*[@id='logo']"))) .build() .perform(); Thread.sleep(1000L); 回答1: It's looks like a bug, I'm not sure what is the solution for this but if you want alternate solution to perform mouse hover

How to do Mouse hover on Image in selenium web driver to get menu list

走远了吗. 提交于 2021-02-10 03:06:05
问题 I am trying to mouse hover on image to display menu list. My HTML code is: <img id="logo" src="/web/images/header/img_Logo_Topbar.png"> But I am trying Xpath as "//*[@id='logo']" . There is no response. I am using this script: Actions a1 = new Actions(driver); a1.moveToElement(driver.findElement(By.xpath("//*[@id='logo']"))) .build() .perform(); Thread.sleep(1000L); 回答1: It's looks like a bug, I'm not sure what is the solution for this but if you want alternate solution to perform mouse hover

Codeception - Can't connect to Webdriver (Acceptance Test)

半腔热情 提交于 2021-02-09 09:20:44
问题 I can access url and create sessions: http://localhost:4444/wd/hub/static/resource/hub.html but when i execute ./codecept run i get an error, but i have Selenium Server running: [ConnectionException] Can't connect to Webdriver at http://127.0.0.1:4444/wd/hub. Please make sure that Selenium Server or PhantomJS is running. To execute Selenium Server, i used this command: java -Dwebdriver.gecko.driver=./geckodriver -jar "selenium-server-standalone-3.12.0.jar" I tried too with IE and Chrome (i