The only way I managed to make moveToElement work is:
def chooseCategory(String a, String b) {
interact {
moveToElement(category(a))
}
interact {
moveToElement(subCat(b))
click()
}
}
As you can see, each moveToElement is in a separate interact block
2016-11-02 22:04 GMT+02:00 Aleksandr Abrosimov <[email protected]>:
> Hi Marcin and thanks for the reply
>
> I've tried your option, but unfortunately the result is the same(
> I can not explain why ONLY moveToElement doesn't work and I feel that
> I missed something important like dependency etc
>
> I am using Java 1.8, Selenium 3.0.1, chromedriver 2.25, Geb 1.0
>
> Marcin, did you manage to choose subcategory?
>
> 2016-11-02 21:17 GMT+02:00 Marcin Erdmann <[email protected]>:
>> I cannot explain why that code works for you with 0.13.1 and not with 1.0
>> but why don't you perform clicking on the subcategory inside of the interact
>> block?
>>
>> def chooseCategory(String category, String subCategory) {
>> interact {
>> moveToElement categoryByName(category)
>> moveToElement subcatName(subCategory)
>> click()
>> }
>> }
>>
>> On Tue, Nov 1, 2016 at 10:15 PM, Aleksandr Abrosimov <[email protected]>
>> wrote:
>>>
>>> Good evening, Marcin
>>>
>>> Here is the code which confuses me:
>>>
>>> class DefaultTestClass {
>>> private static Browser browser;
>>>
>>> @BeforeClass
>>> public static void setUp() {
>>> ClassLoader classLoader = DefaultTestClass.class.getClassLoader();
>>> File file = new
>>> File(classLoader.getResource("chromedriver.exe").getFile());
>>> System.setProperty("webdriver.chrome.driver", file.path);
>>> browser = new Browser()
>>> browser.driver = new ChromeDriver();
>>> browser.baseUrl = "http://www.very.co.uk/"
>>> browser.driver.manage().window().maximize();
>>> }
>>>
>>> @Test
>>> public void start() {
>>> Browser.drive(browser, {
>>> to HomePage
>>> chooseCategory('Men', 'Trainers')
>>> at GalleryPage
>>> })
>>> }
>>>
>>> @AfterClass
>>> public static void tearDown() {
>>> browser.quit();
>>> }
>>> }
>>>
>>> class HomePage extends Page {
>>> static url = 'http://www.very.co.uk/'
>>> static at = {title == 'Very | Womens, Mens and Kids Fashion,
>>> Furniture, Electricals & More!'}
>>> static content = {
>>> categoryByName {catName -> $("#topNav a", text: catName)}
>>> subcatName{ catName -> $(".topNavCol a", text: catName)}
>>> }
>>> def chooseCategory(String category, String subCategory) {
>>> interact {moveToElement categoryByName(category)}
>>> subcatName(subCategory).click()
>>> }
>>> }
>>>
>>>
>>> I know that current code could be refactored...but the main point is
>>> 'interact' block.
>>> I found a workaround - replace moveToElement on clickAndHold, but
>>> again it is not what I want.
>>> NOTE: While you trying to reproduce it, keep mouse cursor in the
>>> bottom of the page
>>>
>>> Marcin, thank you in advance and I'm looking forward for a feedback
>>>
>>> Thanks,
>>> Alex
>>>
>>> 2016-11-01 23:12 GMT+02:00 Marcin Erdmann <[email protected]>:
>>> > Hi Aleksandr,
>>> >
>>> > Can you please share your code that performs the interaction in
>>> > question?
>>> >
>>> > I don't think anything related to handling of mouse actions in the
>>> > interact
>>> > { } blocks changed between 0.13.1 and 1.0. There were some
>>> > implementation
>>> > changes in that area but they were released as part of 0.13.0.
>>> >
>>> > Marcin
>>> >
>>> > On Tue, Nov 1, 2016 at 12:17 PM, Aleksandr Abrosimov
>>> > <[email protected]>
>>> > wrote:
>>> >>
>>> >> Hi, I'm using Geb 1.0v and faced with unexpected behavior:
>>> >>
>>> >> After I apply 'moveToElement' for an element from drop down menu, it's
>>> >> just highlighted and nothing happen - menu doesn't fall down.
>>> >> It seems like cursor hovers over menu item and takes away at once.
>>> >>
>>> >> The same peace of code works fine for Geb 0.13.1v
>>> >>
>>> >> Thanks,
>>> >> Alex
>>> >>
>>> >> --
>>> >> You received this message because you are subscribed to the Google
>>> >> Groups
>>> >> "Geb User Mailing List" group.
>>> >> To unsubscribe from this group and stop receiving emails from it, send
>>> >> an
>>> >> email to [email protected].
>>> >> To post to this group, send email to [email protected].
>>> >> To view this discussion on the web visit
>>> >>
>>> >> https://groups.google.com/d/msgid/geb-user/ee37f351-9fcb-41ef-83a5-e14f346d4eb6%40googlegroups.com.
>>> >> For more options, visit https://groups.google.com/d/optout.
>>> >
>>> >
>>> > --
>>> > You received this message because you are subscribed to a topic in the
>>> > Google Groups "Geb User Mailing List" group.
>>> > To unsubscribe from this topic, visit
>>> > https://groups.google.com/d/topic/geb-user/oiQFSbY5OXo/unsubscribe.
>>> > To unsubscribe from this group and all its topics, send an email to
>>> > [email protected].
>>> > To post to this group, send email to [email protected].
>>> > To view this discussion on the web visit
>>> >
>>> > https://groups.google.com/d/msgid/geb-user/CA%2B52dQS1G3uc-_QRwyvOuAZ10D9A8mUXrW6Obf064HkCchWgSA%40mail.gmail.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Geb User Mailing List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/geb-user/CAESZyvqDobPcuQBJTqA-oPE7mqKCduxDB1Stnz9YjG_wBQBGBw%40mail.gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Geb User Mailing List" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/geb-user/oiQFSbY5OXo/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/geb-user/CA%2B52dQSJ93m-W%2BmoVTpPWW4B_aMZp%2B9OZiUoOG2WqNUJGTO%3DFA%40mail.gmail.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Geb
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/geb-user/CAESZyvqQPm8ih7kWhH_kfxwQ13Za8tpXHSv299t35LfG8QT9PQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.