Wednesday, 31 May 2017

css selector for multiple ng-view in a html page

I'm trying to get css path for text box in a webpage which has multiple ng-view tags and classes with the same name (ng-view) as: ...

<body class="learn-bar ng-scope" ng-app="todomvc">

<aside class="learn">

<ng-view class="ng-scope">

<section id="todoapp" class="ng-scope">

<header id="header">

<h1>todos</h1>

<form id="todo-form" class="ng-pristine ng-valid" ng-submit="addTodo()">

<input id="new-todo" class="ng-pristine ng-valid ng-touched" 
placeholder="Intended web element for which css path is needed" ng-model="newTodo" 
ng-disabled="saving" autofocus="">

....

firebug extension on mozilla provided css selector as: html body.learn-bar.ng-scope ng-view.ng-scope section#todoapp.ng-scope header#header form#todo-form.ng-pristine.ng-valid input#new-todo.ng-pristine.ng-valid.ng-touched

which doesn't seem to work when I do:

// node.js + selenium webdriver bindings
driver.findElement(By.css("<above css path>")).sendKeys("value");

and gives error:

NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector": <above css path>}

How do I bypass these ng-view tags and point to appropriate web element?



via pritam

No comments:

Post a Comment