Please post your Web Driver questions in official Web Driver forum

Saturday, October 22, 2011

Using xPath to reach parent of an element

Well, I am big fan of css locator my self there are times when css locators don't fit requirement. One such requirement is when you want to navigate to parent element of an element and may be parent of parent and even more. Unfortunately css locators don't provide any mechanism to navigate to parent of an element. See this for more.

Of late I came across a scenario when I wanted to click on a link depending upon the text in a text box. Herein parent of text box and parent of link were at the same location. More over there could have been many such combinations in application. Fortunately I just need to pick first such instance and Web Driver any way considers only first instance when multiple locators are found matching an element. Element in question is in following html -















Here I need to click on highlighted anchor on the basis of input element (which is also highlighted in image)

Herein first I need to reach div parent (class = 'left couponmainarea 2) of input element.
This can be reached using parent axes twice from input element -


//input[contains(@value,'.')]/parent::div/parent::div

Now I need to reach previous sibling of div which is another div (class= 'left votes'), which could be achieved using preceding-sibling axes -

//input[contains(@value,'.')]/parent::div/parent::div/preceding-sibling::div

And now I can easily select the anchor tag -


//input[contains(@value,'.')]/parent::div/parent::div/preceding-sibling::div/a[2]


I had posted this question on Web Driver Google group and Luke suggested to use following xPath (basically it avoids using parent word though does the same thing) -

//input[contains(@value, '.')]/../../preceding-sibling::div/a[2]


Pro Tip: Web developers can move their web development and designing environment into cloud having endless hosting space with innovative cloud products from CloudDesktopOnline.com with 24*7 commendable tech-support from www.Apps4Rent.com, You can also add your MS office to your virtual desktop by visiting www.O365CloudExperts.com.

Looks like I can not have only css locators in my tests, at least till there is no Parent selector available in css locator.


Thursday, October 13, 2011

Google, you display "test" ads on publisher site???






Monday, October 3, 2011

Long live Yahoo!

My work at Yahoo! has come to an end and I must show gratitude to those who made my tenure at Yahoo! most memorable one. On my last day we went for team lunch and I was being asked to give a speech and I did not coz I was not feeling that it was any different day for me. Just seemed like an ordinary day.

I wan to begin this post with a name which has disillusioned my cynical attitude towards managers - Padmaja Raghavendra who has been instrumental in having many Yahoo! properties see day of light and I was the fortunate one to have got the opportunity to work with her. She works painstakingly and yet most caring person I met at Yahoo! I wish Indian managers take a cue from her than our IT industry would not be as ill.

Jithin and Partha, two most amenable developer I worked with. A few developers just never lose temper and know what is right under a given situation. It seems impossible that any one would ever be at daggers drawn with them.

My other team members - Vinit, Anand, Arnold (Saravanan) Satya in whose company day passes by in the blink of an eye. When you cease to work in a company these are the good memories you wan to remember forever. I am inclined to believe that it is not the task in hand but the your team which keeps you engaged and encouraged with work. And I got the blend of both.

Sri Vidya, my only TT partner (or may be the only to have courage to ply TT with me :P) and yet another Yahoo! gem.

This posts wold be incomplete if I don't mention Praz. A very geeky guy yet full of humour. His timing are so perfect that I would often suggest him to be a comic script writer than an Engineer. I must say that Yahoo! is what it is because of engineers like Praz and owes big to him.

Ramgopal Reddy who impressed me most when I was being interviewed at Yahoo! He impressed me coz he found me waiting for my next rounds and offered me help if I needed any thing. Now how many us show such attitude towards interview candidates. At least I did not till I had come to Yahoo!

Raghavendra Kulkarni, most inquisitive tester I have come across in my career. He is never out of question and will drain every single piece of information which even you might not be aware of you had. If there were ever a nomination for most curious tester in India, my vote will be for Raghavendra.

Nikhil R and Nikhil  B. Some managers are always calm. And both Nikhils epitomize this.

Last but not the least, two more names - Pranesh, my mentor who I could approach for any thing and Praveen Prakash Desai who made it smooth for me to work at Yahoo! Liberty was the prime thing I had on my mind when I was to begin work with Yahoo! and Praveen got more than I had wished for.

These are few of those sweet memories I would always cherish. Long live Yahoo! long live Yahoos.

Saturday, October 1, 2011

Lollipop of US Visa



There is great charm about on-site (read USA) work in employees of Indian IT service industry. This is also seen as great tactic by your employer to keep you engaged with company and not hop job. You are often offered an on-site trip if you are the project savior and decide to quit. And few of you indeed get to go to client place with great pride. But do you get to go on work visa? By and large answer is NO. And probably you don't even know that you are sent to work on illegal visa, famously known as B1 visa. There is nothing illegal about B1 visa per se but this category of visa allows only business meeting or attending seminars. This is why there is initial cap of 3 months to stay. Once it is stamped by your employer that you would travel on-site, this how whole story goes -
  • You are scheduled for an interview with US consulate. Your HR comes to train you on how you should speak about supposed business trip and not utter a word about work
Fork me on GitHub