# Path: src/test/python/bpt/pages/basepage.py
# class BasePage(Page):
#     def __init__(self, url=None, *elements, **conditions):
#         super(BasePage, self).__init__(
#             *elements, **conditions
#         )
# 
#         if url:
#             self.parent.launch(url)
#             self.parent.maximize()
# 
#         self.parent.sync()
# 
# Path: src/test/python/bpt/pages/searchresultspage.py
# class SearchResultsPage(BasePage):
#     def __init__(self, url=None, *elements, **conditions):
#         super(SearchResultsPage, self).__init__(
#             url, *elements, **conditions
#         )
# 
#         self.lnk_first_record = WebLink(
#             tag='a',
#             xpath='//div[@id="b_content"]/ol[@id="b_results"]/li//a'
#         )
# 
#     @property
#     def text_of_first_record(self):
#         return self.lnk_first_record.text


from taf.modeling.web import WebButton
from taf.modeling.web import WebTextBox
from .basepage import BasePage
from .searchresultspage import SearchResultsPage
# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.



class BingHomePage(BasePage):
    def __init__(self, url=None, *elements, **conditions):
        super(BingHomePage, self).__init__(
            url, *elements, **conditions
        )

        self.txt_search_box = WebTextBox(id='sb_form_q')
        self.btn_search_go = WebButton(id='sb_form_go')

    def search_with_keyword(self, keyword):
        self.txt_search_box.set(keyword)
        self.btn_search_go.click()


# Path: src/test/python/bpt/pages/basepage.py
# class BasePage(Page):
#     def __init__(self, url=None, *elements, **conditions):
#         super(BasePage, self).__init__(
#             *elements, **conditions
#         )
# 
#         if url:
#             self.parent.launch(url)
#             self.parent.maximize()
# 
#         self.parent.sync()
# 
# Path: src/test/python/bpt/pages/searchresultspage.py
# class SearchResultsPage(BasePage):
#     def __init__(self, url=None, *elements, **conditions):
#         super(SearchResultsPage, self).__init__(
#             url, *elements, **conditions
#         )
# 
#         self.lnk_first_record = WebLink(
#             tag='a',
#             xpath='//div[@id="b_content"]/ol[@id="b_results"]/li//a'
#         )
# 
#     @property
#     def text_of_first_record(self):
#         return self.lnk_first_record.text


# Path: src/test/python/bpt/pages/binghomepage.py
from taf.modeling.web import WebButton
from taf.modeling.web import WebTextBox
from .basepage import BasePage
from .searchresultspage import SearchResultsPage

# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.



class BingHomePage(BasePage):
    def __init__(self, url=None, *elements, **conditions):
        super(BingHomePage, self).__init__(
            url, *elements, **conditions
        )

        self.txt_search_box = WebTextBox(id='sb_form_q')
        self.btn_search_go = WebButton(id='sb_form_go')

    def search_with_keyword(self, keyword):
        self.txt_search_box.set(keyword)
        self.btn_search_go.click()


        return SearchResultsPage()