How to use the DOM locators in Selenium

I've the HTML source like this, <input type="image" onclick="return logSub();" src="/images/Login_submit.gif" width="105" height="33" border="0" /> Here there is no ID or NAME. So I can only locate this using image index (which is hard) or using the src tag? But I dont know how use the src tag? Is that possible?

Selenium: Stored variable is not considered across test cases while executing test suite from command prompt

I have a test suite with 3 test cases, out of which first test case has all the variables required in the other 2 test cases(something like its a dataset for the test suite) All this while i was executing testsuites in selenium IDE (Manually loading the test suite in IDE and then run), everything was fine. But i wanted a report for the test case execution, so now i am using below command to execute the testsuite java -jar "selenium-server jar path" -htmlSuite "*firefox" "baseurl" "TestSuite pa

How to pass control to a new window(not popup) in selenium?

My site has a link which navigate to another site. I have to check whether the link taking the user to correct website. The following is the code i've written to pass control"link=target window"); selenium.selectWindow("Title of target window"); assertTrue((selenium.isTextPresent("content in target window"))); selenium.close(); selenium.selectWindow("null"); But if i run this i'm getting error like "Could not find window with title ...

Selenium webdriver : how to find the element in DOM based on custom attribute

How can I find the element in DOM based on a custom attribute? For example: DOM attributes are not present in HTML view. Using DOM inspector I can able to identified the Custom attribute is unique. driver.findElement("SimpleSearch:dIndicesGrid:1:Value")).getAttribute("_celltype"); Here _celltype is custom attribute. This attribute is not visible in HTML view.

How to capture the screenshot of a specific element rather than entire page using Selenium Webdriver?

Currently I'm trying to capture a screenshot using the Selenium WebDriver. But I can only obtain the whole page screen shot. However, what I wanted is just to capture a part of the page or perhaps just on specific element based on ID or any specific element locator. (For example, I wish to capture the picture with image id = "Butterfly") Is there any way to capture a screenshot by selected item or element?

Selenium IDE:- Error on a basic recorded login script

Configuration Manifesting Windows 7. FireFox 22. RAM 2 GB. The following error occurs when we try to click on login button:- [error] Unexpected Exception: fileName -> chrome://selenium-ide/content/selenium-core/scripts/htmlutils.js, lineNumber -> 309, columnNumber -> 8 Source code:- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""> <html xmlns="" x

Selenium How to Double Click on plain text in webdriver?

I have moved mouse pointer on to a certain plain text (a word) by this: Robot robot1 = new Robot(); robot1.mouseMove(430,628); //location of the text/word Now I just need to double click so that my text/word gets selected. Can you help me on how to do that? I tried action builder without element ID (as it is a plain text) for doubleclick, which does not work.

How can I avoid "no response from server URL" exception when using hub on Selenium remotewebdriver when object is not found?

This is the code I am getting error on line 1. Instead of returning true or false it throws an exception " No response from server for url: http://test:4444/wd/hub/session/1382359342795/element Getting error on line1 : Boolean tInputElement = driver.FindElement(By.Id("locator")).Enabled; if (tInputElement.ToString() == "True") { IWebElement InputElement=driver.FindElement(By.Id("locator")); InputElement.SendKeys(InputData); } Please suggest how can I avoid no response error and catch o

Selenium why my test case under ant always runs twice?

I'm try to configured webdriver+testNG working with Ant. It's a simple test case, launch FF and open But when I executed the build.xml with ant,the test case executed twice! It's puzzle to me, I suspect something wrong in "Ant suite", and I don't know how to disable is my code. Eclipse Console output: init: compile: [javac] D:\Workspace\HelloAnt\build.xml:23: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false

Selenium Programmatically starting server in one thread and running test in other thread using maven test command

I have written cucumber/ selenium test cases for my spring mvc project. My intention is, when I run mvn test from console, I am starting jetty server with spring(mvc dispatcher) beans loaded in one seperate thread and while normal flow consist of running cucumber test cases. Like the one below. @RunWith(Cucumber.class) @Cucumber.Options(format = {"pretty", "html:target/cucumber"}) public class RunCukesTest { @BeforeClass public static void setUpBeforeClass() {

Selenium-IDE 2.5 cannot identify objects or links inside a frame

I'm using Selenium-IDE 2.5 and Firefox 26.0, the problem with Selenium-IDE 2.5 is that it doesn't identify or locate a link or any objects inside a frame and I couldn't write the proper code for that. When I use Selenium-IDE 2.0.0 version it can identify the link and object inside a frame. Unfortunately I couldn't find the path to download IDE 2.0.0. I would be very much obliged if you can help me with a solution for this.

Selenium - Throwable does not catch exception

I am trying to use throwable class in my code given below & for some reason its not catching an exception in particular scenario. My test case is to verify a particular text on google search page after Safe Search mode is On. So basically i am matching the text 'SafeSearch on'(which we normally see next to the settings button on the google page if Safe Search is ON) with the Xpath of that location.I am using assertion. My test case executes fine when the 'SafeSearch on' text is there on the

Selenium Understanding WebElement.findElement() and XPATH

I want to use the WebElement.findElement() API to locate a node inside the parent node using XPATH //span[@class='child-class']. I thought this would return me the <div> that is inside the parent. However, it is returning me the first one it found in the entire DOM tree. Did I use the wrong XPATH? I have also tried using .//span[@class='child-class'] as the XPATH, but that does return anything. Thank you. UPDATE: given the HTML below, I want to define a locator for the child-title <

Selenium Having issue in selecting drop down element under makemytrip website

Having issue in selecting drop down element under the following website I'm unable to select any one of the cities listed below. Please help me out resolving the same. Scenarios Tried driver.findElement(By.className("chzn-single")).click(); driver.findElement(By.xpath("//span[contains,'NewDelhi']")).click(); driver.findElement(By.xpath("//span[@id='fromcity_chzn']")).click();

Selenium Headless browser testing with download functionality?

I've been looking for a solution to do headless testing in osx. But I need the ability to save files returned by the server. I've tested selenium, phantomjs, casperjs and have looked into anything I could find online. none of them supports downloading. am I missing something? are there any headless browser/testing frameworks that support downloads?

Selenium IE9 - OpenQA.Selenium.NoSuchWindowException

When running a selenium based test on IE 9, I see the following exception raised for an element that does exist on the webpage: An exception of type 'OpenQA.Selenium.NoSuchWindowException' occurred in WebDriver.dll but was not handled in user code Additional information: Unable to find element on closed window (WARNING: The server did not provide any stacktrace information) This error does not occur on Chrome for example. Does anyone know why this would occur and what the resolution to this is

What tools should I use Selenium or nightwatch or other to automate data entry on few similar websites at the same time?.

I need to enter pretty much the same date on few handful of similar sites using web automation tools/ software. I am not doing testing I just want to use automation side of the tools. I need to enter the data same time ( as real time as possible ). I am wondering if one tool has advantage over other as I am using it just for automation.

Selenium Why the ignoreProtectedModeSettings of the IE driver allows to find elements by id with Protractor?

I'm learning Protractor by making a very simple test: describe('Tick Tack Toe game', function() { it('marks positions as played', function() { browser.ignoreSynchronization = true; browser.get('file:///C:/Users/potero/angular/Angular_TickTackToe/ticktacktoe.html'); var p00 = element("p00"));; expect(p00.getText()).toEqual("X"); }); }); This test passed in Chrome almost effortlessly. But I also have to test on IE so I added the necessary lines to my pr

Selenium code not working on Safari browser

I have written the following code to select Account - Register menu option in public void selectRegisterAccount(String object){ System.out.println(object); writeLog("Executing keyword selectRegisterAccount"); try{ Thread.sleep(1000); actions = new Actions(browser); actions.moveToElement(browser.findElement(By.xpath(project.getProperty("XPath_linkAccount")))).perform(); actions.moveToElement(browser.f

Exception in thread "main" org.openqa.selenium.NoAlertPresentException: no alert open

Using Selenium Webdriver,I tried to open fb page after logging in. Once I logged in ,there is a pop up box appearing as follows "Show notifications Allow and Block" I want to select "Allow" button. I got an error message as Exception in thread "main" org.openqa.selenium.NoAlertPresentException: no alert open Please help. Here is the code I wrote: System.setProperty("","C:\\Users\\ABCD\\Desktop\\chromedRiver.exe"); WebDriver driver=new ChromeDriver(); driver.

Selenium How to check whether the page loaded with the correct url and tab title

I wrote a method to load the page navigation links. The method works, but when I added code to check the correct URL and tab title my test is not performed. Sometimes it happens that for loop fast clicks on the pages the side that does not get loaded, I do not know whether it is a problem but I can not check whether a page loaded with the correct url or tab title, or the problem is the code that I wrote for check the correct url or tab title. This is my method: public void showNavigationLinks

Not able to click the Inline element using selenium webdriver

enter image description hereNot able to click the inline element using selenium webdriver. Here is the URL Besides Images link (Right side top) there is a square icon. Need to click that icon and select Maps. Screenshot attached. I used xpath, cssselector, ID, Name but nothing is working. Could anyone help me on this. Code: import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.o

Selenium How to check the element titled AA E-mail Address is enabled or not

Hi I have the following html, <td class="ms-crm-ReadField-Normal ms-crm-FieldLabel-RightAlign" id="agf_accountaccessemailaddressverified_c" title="AA E-mail Address Verified?"> <span class="ms-crm-InlineEditLabel"> <span class="ms-crm-InlineEditLabelText" style="max-width:200px;text-align:Right;width:80%;"> AA E-mail Address Verified? </span> <div class="ms-crm-Inline-GradientMask" style="display: none;"> </div>

Selenium keycode conversions, consider using Xvfb

Google Chrome last version from official repository ChromeDriver last version installed Selenium last version installed My wdio.conf.js desiredCapabilities: { browserName: process.env.BROWSER || 'chrome', chromeOptions: { args: [ '--disable-gpu', '--headless', '--no-sandbox', ], prefs: { 'download.default_directory': __dirname + '/tmp/test/download', 'download.prompt_for_download': false } } }, My

how to find subsequent tags in selenium for a particular tag

I'm trying to click on 'Recommended' input tag of a 'Samsung' label. Please find the appropriate HTML code below. ` <div class="card-wrapper"> <a class="card-focus has-shadow" href="/app/72292"> <div class="card-container"> <div class="card-logo"> <section class="card-info"> <div class="card-name">Samsung Push Service</div> <div class="card-publisher hidden-xs">Samsung Push Service</div> </section> <div class="card-rating"> </

Selenium Not able to validate a Popup Overlay in my application

I am using Selenium webdriver using Cucumber. I have clicked a button which open up a popup box, containing few web elements within it. I need to perform few validations in this pop up box. But once the overlay popup is displayed, I am not able to validate it using isDisplayed. In the console, it display a Error message - java.lang.NullPointerException but I am not passing any value in any variable to validate this popup box. My script is as below: public static void Popupbox() { s

Selenium ChromeDriver silently fails to click

For some reason, the Selenium "click" command no longer works on my laptop. It doesn't throw an 'Element is not clickable' error or anything, it acts like it succeeded but no click actually happens. I set up a very simple example to debug: a plain HTML page with a <form method="post" action="/whatever"> containing a single button with type='submit'. Looking at Selenium logs, it appears to be sending the POST command to /click without an issue. Looking at the chromedriver logs, it seems t

Selenium Throwing null pointer exception on driver.get(URL)

I am facing null pointer exception on driver.get(URL) while running the code.I am using Selenium 3 with TestNG.Here, I am trying to verify URL using Assert.Please help with some solutions. import org.testng.Assert; import org.testng.annotations.Test; import org.testng.annotations.BeforeClass; import static org.testng.Assert.assertEquals; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import; import org.testng.annotations.BeforeClass;

Is it possible to send the value of the Tab Key in Selenium?

I ran into a scenario recently where a user copied the value of a tab key plus some characters from a word document and pasted it into a field in the application. The value would look like this: "TEST " The regex for the input field allows alpha-numeric and underscores and trims out spaces. But for some reason it allows the tab and does not see it as a space and therefore did not trim it out. It caused issues for the application and we have since fixed the problem, but I am trying to find

Can't click parent with selenium

I need to click this HTML with selenium: <span title="Klik for at oprette booking" onclick="sende('proc_straks.asp','opret','11-02-2018;1;18;20:00;20:45;0;','','', '046009a83941f411fb90c9790a0c92a8')" style='height:52px;' class='banefelt btn_ledig link '> <div class='padding5'> <div>20:00 - 20:45</div> <div class='clearfix'> </div> </div> </span> So I tried this python code: for i in range(1500): if driver.find_elements_by_tag_name("div")[i

Selenium Watir webdriver

I've been using the Watir webdriver for a while now and out of the blue I'm getting the following error: Selenium::WebDriver::Error::UnknownError unknown error: call function result missing 'value' when trying to set text and other functions. The script worked fine yesterday... so something has gotten updated and stopped working. I've already tried updating the chromedriver to the latest one, but am still getting the error. chrome=65.0.3325.146 chromedriver=2.31.488774 ActionView::Templat

Selenium WebDriverException: unknown errors ("chrome failed to start" and "Failed to create a Chrome process")

After installing Katalon Studio v.5.8.2 to a co-workers laptop, when trying to run the test, test fails with this exception Test FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: '' (Root cause: org.openqa.selenium.WebDriverException: unknown error: chrome failed to start (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not

Chrome xpath expression for selenium does not find element

In a webpage I have the following elements: .... <select class="widget-listbox form-control" size="6" multiple="multiple"> <option data-value="sIPSCs%20from%20juvenile%20(P21-30)%20C57BL%2F6J%20male%20mice%20hippocampus%20CA1%20pyramidal%20cell%20(A1)" value="sIPSCs from juvenile (P21-30) C57BL/6J male mice hippocampus CA1 pyramidal cell (A1)" class="">sIPSCs&nbsp;from&nbsp;juvenile&nbsp;(P21-30)&nbsp;C57BL/6J&nbsp;male&nbsp;mice&nbsp;hippocampus&

What is the correct IEDriverServer version to use with IE 11 through Selenium

I just got updated to Windows 10 (x64). My old desktop had IE 11 but a lower version, as it was running Windows 7. I now have the following IE version: Version: 11.648.17134.0 Update Versions: 11.0.115 I downloaded the latest IEDriverServer.exe that Selenium gave me (3.14). When I run it, when I do the get(url) (various urls), afterwards it fails to find elements. I looked and noticed that before the get(), driver.getWindowHandles() had one entry, but after the get() it had zero entries.

Selenium what is the Purpose of Remote webdriver between webdriver interface and chromedriver class

Search Context is the super most interface in selenium, which is extended by another interface called Web Driver. -All the abstract methods of Search Context and Web Driver interfaces are implemented in Remote WebDriver class. -All the browser related classes such as Firefox Driver, Chrome Driver etc., extends the Remote Webdriver class. As per the above stmt How the remote web driver class can give the definition for all the abstract methods which defined in the search context interface and web

Selenium Xpath for Submit button with precedence nodes select file and *

Query 1: I would request you to please help me on getting xpath for submit button. Absolute path starts with Select file and *. <div id="bg"> <label id="label" style=" font-family: Segoe UI;color:#2e2e2e; font-size:12px; float:left; padding-top:8px;"> Select File <span id="spanhide" class="red">*</span></label> <div style="margin-left:105px;"><input type="file" name="filUploadIcon" id="filUploadIcon" class="txt-box" onchang

Selenium aws lambda: How to fix 'geckodriver' executable needs to be in PATH"

So I am trying to use firefox in aws lambda runtime Python3.6 I have added my dependencies using layers in this order: selenium3.14, geckodriver25 and firefox 69 binary, to create my webdriver instance I am using this code: from selenium import webdriver from selenium.webdriver.firefox.options import Options path = '/tmp/' def start_browser(url, headless=True): fp = webdriver.FirefoxProfile() options = Options() if headless==True: options.headless = True fp.set_prefere

Selenium While Loop is not getting entered which I have in my one of the step as part of stepdefinition file

Logic provided in the while loop is not running even though the condition is met. This is the step definition file for selenium using cucumber. @Then("checks for the title of the page") public void checks_for_the_title_of_the_page() { String password1 = ""; String title = driver.getTitle(); System.out.println("Title of current page: " +title ); System.out.println("I am right before control statement now" ); while (title == "Amazon Sign In") {

How to reduce number of selenium webdriver instances being spawned by scrapy on running crawl on a spider?

On running crawl process for any spider, Scrapy tends to spawn a lot of (27 average varying between 19 - 30) Firefox instances, even if the spider being run is not using selenium. I have tried driver.quit() inside def __del__(self) in each of the spiders using selenium. The problem still persists. The Firefox instances stay open even after the crawling process is finished. example spider using selenium: import logging import time from os.path import abspath, dirname, join import requests

Selenium winium properties name and id does not exist

I am trying to automatically fill a form of a desktop application using winiun.desktop.driver but the element does not have a Name or ID that I can use. Can you help me find a way of reaching this text box? Below are properties and values showed at the insights: Property Value Name Property does not exist AriaRole Property does not exist AriaProperties Property does not exist HelpText Property does not exist AcceleratorKey Property does not exist AccessKey

Selenium is there a way to pass data directly in Step definition without passing in feature file?

i want to use dataprovider to pass data directly into step definition without passing from feature file, as i want to pass null values as well. here is what i am doing. Scenario: User should get empty field highlight, when that fields is empty and clicked submit. When Submit is clicked after providing values in nethier or either of Reg Id or PC @Test(dataProvider = "getData") @When("^Submit is clicked after providing values in nethier or either of Reg Id or PC$") pub

Selenium on Macbook m1

I was wondering to buy a new macbook Air M1. I wanted to know if selenium testing tool working properly on the same machine? Please share your experience if anyone has tried it yet.

Selenium get access to text using css

I am trying to access text of table data using Selenium and then checking if it is equal to given text. The problem I am facing is Expected result gets converted to Array with [] brackets. How can I convert this to basic string? What code change will help me achieve this? Below is my code const resultList = element.all(by.css('table tr:nth-of-type(9) [colspan]')); expect(resultList.getText()).toEqual("This is data"); Output - Error Expected [ 'This is data' ] to equal 'This is data'

Why Selenium started Chrome doesn't show save password dialog?

I have done a lot of searching on this topic but I never found a working solution. I believe that I know a lot about Selenium and I don't understand why things not working for me on Chrome, but working on Edge (Chromium-Based) Starting browser with Selenium I use the same method to start both Edge (89.0.774.54) and Chrome (89.0.4389.90). Using C# with OpenQA.Selenium (4.0.0-beta2) I add user-data-dir argument to set up a profile path (but the path is empty, so the profile is generated by Seleni

Causes of Selenium failing when being executed as SYSTEM user from a Windows Scheduled Task

For some context, I have a Windows Scheduled Task set-up running as the SYSTEM user, which periodically opens a small Console Application which makes use of Selenium and specifically the IE Driver. This works perfectly well for a long period of time, but after a month or two has passed it eventually begins failing every time the scheduled task executes with the error below. The only solution I have found is to restart the application server, whereby the issue is resolved for another month or two

  1    2   3   4   5   6  ... 下一页 最后一页 共 61 页