is there a way to use xpath in a more flexible way? for example, selenium ide generated the following code: "driver.findElement(By.xpath("//input[@...;, but i have multiple dropdowns that could dynamically contain the same 'Filtering' valued input element on a page reload. i'd like to do something more like this: "//*[@id='filter-site']...//input[@...; where '...' could be anything but is still contrained to
the 'filter-site' specific dropdown. is something like this possible?
merobertsjr_ joined the channel
merobertsjr__ joined the channel
merobertsjr_ has quit
kyoob
you can put wilds between slashes anywhere in the xpath. so like "//*[@id='filter-site']/*/input[@value='Filtering']"
eindoofus
kyoob, oh wow, i was thinking that wasn't possible :).
jleyba
better yet, use css: "#filter-site input[value='Filtering']"
kyoob
^^ +1
jimevans
jleyba: +1
Sourcerer joined the channel
kyoob
i actually just used xpath for the first time in many many moons today
i have a known string and wanted to make sure it's in a <span>
jimevans
kyoob: xpath has its uses. those uses are far fewer than most people expect.
"#filter-site input[value='Filtering']" doesn't seem to work in selenium ide
kyoob_
are you sure it's looking for css and not still xpath?
kyoob has quit
eindoofus
kyoob_, looks like jleyba's example uses both
kyoob_
"#filter-site input[value='Filtering']" is a css selector
cweng joined the channel
no xpath in it
kyoob_ is now known as kyoob
eindoofus
oh. shouldn't it still work in selenium ide? i don't see a way to specify whether it's xpath
jimevans
css="..."
eindoofus
ahhh
cool. thanks
kyoob
it's been a while but isn't the argument formatted like .. css="#filter-site input[value='Filtering']"
simonstewart has quit
jimevans
just another reason i abhor selenium ide.
kyoob
now now
eindoofus
i'll eventually get away from it once i get these selectors down
kyoob
selenium ide taught me perl
in a way
the export libraries are clutch fora a novice
barancev
simonstewart leaved the chat because you talk about selenium ide
kyoob
ha
man, record and playback tools get a bad rap
jimevans
kyoob: they're useful in some cases, but, like xpath, that utility is far more limited than most people really want to believe.
eindoofus
how should i structure Page Objects if i have a lot of javascript strangeness going on? for example i have five dropdowns i need to open/search/select/deselect items from but nothing changes between them other than that css id. would hate to write a custom method for each action with each dropdown.
cweng
For some reason dropdowns don't play nice with firefoxdriver after a parallax
jimevans
eindoofus: private helper methods that take the element in as an argument?
cweng
the whole page shifts when attempting to select the dropdown
kyoob
jimevans this is true. i think if someone could build a really super-capable selenium ide type thing, a lot of automation people would be out on the street.
jimevans
kyoob: lots of people smarter than me have been trying to create something "really super-capable" for at least the last two decades. i've yet to see it.
kyoob_ joined the channel
kyoob_
dangit
jimevans
kyoob_: you didn't miss much. just me saying "i've yet to see something 'really super-capable' in that space"
kyoob_
jimevans well, who would want to work on that project?
eindoofus
jimevans, so i would pass the element itself? i was thinking of passing just the css id as a sting and then having a method that concatenates it before grabbing the element within the helper method
jimevans
but i've seen enough snake oil salesmen try to say they had it that i'm immediately skeptical
eindoofus
string*
lukeis
No More RC!
For Science!
kyoob has quit
kyoob_ is now known as kyoob
( ¯\_(ツ)_/¯ and On my way! are the other keyboard shortcuts i have too)
jimevans
eindoofus: either way. the point is that you don't write the "custom method for each action with each dropdown". you write the custom method once, and execute the same operations a dropdown
of course, you haven't said whether you have page objects or page wrappers, but that's probably immaterial to this discussion.
eindoofus
jimevans, thanks. makes sense. what have you seen people do in terms of the method argument? are they passing elements or strings around. i don't want to do anything that is too hackish and deviates from good practice
jimevans, just Page Objects at this point
kyoob
i don't think it matters which way you go as long as you're consistent throughout your project
jimevans
eindoofus: so you expose no individual screen elements in your object classes? in other words, on a theoretical login page, you do not have "setUserName", "setPassword", and "clickLogin" methods?
jimevans really should write that blog post about the difference between page objects and page wrappers
uh oh. to what degree is it bad? that's the way i've been kind of going about it
been*
jimevans
eindoofus: you're doing it the way most people do.
like i said, don't worry about it. it's not important.
eindoofus
please let me know if you ever write that blog. lol :)
jimevans
i'm feeling like being a pedant about page objects vs. page wrappers.
a page wrapper basically includes methods to manipulate each element on the page, and little else.
kyoob
as long as you get logged in somehow, right?
admc joined the channel
jimevans
page *objects* on the other hand, model the services provided by the page. on a login page, the service would be logging into the application. so it would have a "loginAs" method. or a "submitIncorrectCredentials" method.
*NOT* methods to manipulate each individual element.
most people implement page wrappers, and (mistakenly, imo) call them "page objects"
kyoob: logging in through the UI is usually an antipattern for everything except explicitly testing the flow of the login pages themselves.
kyoob
i was just going along with the example, is all
jimevans
i know, but it needed to be said. :)(
trentp has quit
cweng
For some reason, my chrome is crashing after 50 or so tests
can't seem to find the reason why
kyoob
on windows?
cweng
yes
Windows 8.1
kyoob
check your tasks, you might have a lot of hanging little chromedrivers
titusfortner
jimevans: I'm not sure I'm following your pattern. A Page Wrapper has methods to interact with username and password text fields. Are you saying a Page Object is a separate abstracted object to login using the elements defined in the Page Wrapper?
almostwhitehat joined the channel
kyoob
sometimes i close out a lot of chromedriver tasks and my tests run like a dream. they seem to open when i'm debugging in eclipse fwiw
jimevans
titusfortner: i'm saying that you use one or the other. internally, a page object might resemble a page wrapper, it just doesn't expose the methods to interact with username and password fields outside itself.
but no, it's not a separate object.
or needn't be
cweng
i thought that was the problem too, but I only have one instance of chrome river going right now
jimevans
i suppose you *could* do it that way. i wouldn't.
kyoob
cweng: then i'm stumped!
Selenium-Github
[13selenium] 15lukeis pushed 1 new commit to 06master: 02http://git.io/vfhFx
13selenium/06master 14763bbcb 15rbri: update to htmlunit to 2.16...
cweng: Are you quitting the chrome browser or just closing it?
kyoob
also are you spinning up a separate browser for each test?
MonkeysPaw
kyoob: hahaha, same thought. :)
Jman46t9 has quit
cweng
I am suppressinging the GC until all tests are run
using GC.SuppressFinalize(this);
Sourcerer has left the channel
I'm quitting, closing, and disposing the driver each test as well
MonkeysPaw
cweng: I'm admittedly pretty new to this, but chrome typically runs like a memory hog. I'm inclined to wonder if chrome is just crashing because it's too bloated.
ah, never mind then.
kyoob
how does it crash? 'chrome not reachable' error?
cweng
Operation has timed out
HTTP request to the remote wevdriver server timed out after 60 seconds
And then another browser would't be opened
almostwhitehat has quit
NOTICE: Project HtmlUnit Java Tests build #3437: UNSTABLE in 5 min 46 sec: http://ci.seleniumhq.org:8080/job/HtmlUnit%20Java%20Tests/3437/
testerbit joined the channel
NOTICE: Project Firefox 24 Linux Javascript Tests build #2025: UNSTABLE in 8 min 57 sec: http://ci.seleniumhq.org:8080/job/Firefox%2024%20Linux%20Javascript%20Tests/2025/
testerbit
I'm getting an error on my selenium server when trying to run a chrome test saying the path to driver executable must be set. Does this get set on the server or client?
AutomatedTester
testerbit: set by you
davehunt joined the channel
testerbit
automatedtester: set by me on the client-side or server side?
AutomatedTester
testerbit: whereever your chrome is
testerbit
the error I'm reading off the server
chrome is on the server, where would I define on the server?
AutomatedTester
testerbit: you need to add it to the PATH variable
so |export PATH=$PATH:/path/to/chromedriver| for *nix machines
testerbit
i added the directory to the path, this is a windows machine
AutomatedTester
that should work
testerbit: we normally just try run chromedriver
jimevans
as long as the path isn't under \windows\system
testerbit
does not work
cweng
Firefox and IE drivers still work, only chrome crashes after 40 or so tests
testerbit
"The path to driver executable must be set by webdriver.chrome.driver"
eindoofus has quit
jc2121 joined the channel
AutomatedTester
testerbit: set the property then
HenriettaSalt has quit
dimacus has quit
jc2121
Newbie question. Using C#/NUnit/Selenium. When you start a test in NUnit, where does processing begin exactly?