开发者

WatiN SelectList or DIV Click from Google Adwords Keywords Page

I have tried everything but no luck. I am using Watin and C# .NET

What I am doing is going to:

https ://adwords.google.com/o/Targeting/Explorer?__u=1000000000&__c=1000000000&ideaRequestType=KEYWORD_IDEAS#search.none

Note: There's no space between https and ://, but I had to add it because of a markdown problem

Entering the captcha manually (typing the text from Watin).

After you search for keywords, you will see that in the bottom of the page you have a Next and a Previous button.

I would like from WatiN to go to page 2, 3,...

It sounds simple, click on the div (with id gwt-debug-aw-paging-next ) and it will go to next page, but it does not happen.

I tried FireEvent, click, KeyDown, everything ... but it's not working.

I also tried to select 100 results from the Selectlist, but again, it does not work.

I tried it in all ways:

browser.DomContainer.SelectList("gwt-debug-aw-paging-list-box").Option("100").Select();

Nothing seems to work when talking about the buttons from the bottom right of the page.

I managed to "simulate" the click on Broad or Exact results, but not with the bottom buttons.

Any suggestions?

Edit 1:

I uploaded an image so you can see exactly the button I am talking about:

WatiN SelectList or DIV Click from Google Adwords Keywords Page

Click here to view it larger.

<div id="gwt-debug-aw-paging-next" class="goog-button-base goog-inline-block goog-button aw-btn aw-pagination-button" tabindex="0" title="Next page">
<input type="text" tabindex="-1" style="opacity: 0; height: 1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;">
<div class="goog-button-base-outer-box goog-inline-block">
<div class="goog-button-base-inner-box goog-inline-block">
<div class="goog-button-base-pos">
<div class="go开发者_运维问答og-button-base-top-shadow">&nbsp;</div>
<div class="goog-button-base-content">
<span id="gwt-debug-aw-paging-next-content" class="aw-pagination-next">&nbsp;</span>
</div>
</div>
</div>
</div>


Please paste the markup of the element you would like to click, including a parent element or two.

This will help in suggesting solutions.

Thanks.


So the following does not work?

using(IE ie = new IE("your-page's-url"))
{
    // ... any steps needed to bring up the page in question ...
    ie.Element("gwt-debug-aw-paging-next").Click();
}

If not, maybe try clicking on the span gwt-debug-aw-paging-next-content.


I managed to solve the problem. Another programmer gave me this tip, so the credits go to him.

The idea is that there are more spans with the same ID in google adwords (strange, I know), so what we need to do is click on every span, not only at the first span.

Here is the final code that needs to be added:

var pagination = browser.Spans.Where(e =>
e.IdOrName == "gwt-debug-aw-paging-next-content").ToList();

foreach (var item in pagination)
item.Click();                                
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜