How to use set_value_by_js method in Selene

Best Python code snippet using selene_python

configuration.py

Source:configuration.py Github

copy

Full Screen

...72 @property73 def base_url(self) -> str:74 return self._base_url75 @property76 def set_value_by_js(self) -> bool:77 return self._set_value_by_js78 @property79 def type_by_js(self) -> bool:80 return self._type_by_js81 @property82 def wait_for_no_overlap_found_by_js(self) -> bool:83 return self._wait_for_no_overlap_found_by_js84 @property85 def window_width(self) -> Optional[int]:86 return self._window_width87 @property88 def window_height(self) -> Optional[int]:89 return self._window_height90 @property...

Full Screen

Full Screen

banner_home_page.py

Source:banner_home_page.py Github

copy

Full Screen

1import os2from selene import Browser3from selene.api import s4from selene.core.configuration import Config5from selene.support.conditions import be6from tests.backoffice.web.pages.backoffice_page import BackofficeBasePage7from tests.backoffice.web.pages.component.combobox import ComboBox8from tests.backoffice.web.support.enuns.filepath_enum import FilePath9class BannerHome(BackofficeBasePage):10 def __init__(self, app: Browser):11 super().__init__(app)12 self.btn_supplier_banner = s('#supplier-banner-modal')13 self.card_new_banner_repository = s('#NewBannerCard')14 def access_btn_by_text(self, btn_title):15 if btn_title == 'Novo banner de fornecedor':16 self.btn_supplier_banner.click()17 self.modal.wait_modal_title_presented(btn_title)18 else:19 btn = self.get_elem_by_text(btn_title).s('./..')20 assert btn.with_(Config(timeout=12)).wait_until(be.clickable)21 btn.click()22 if btn_title == 'Novo banner de simulador de margem':23 self.modal.wait_modal_title_presented(btn_title)24 def combo_supplier(self):25 combo = self.modal.combo_by_title('Fornecedor')26 return ComboBox(combo)27 def combo_validity(self):28 combo = self.modal.combo_by_title('Período de vigência')29 return ComboBox(combo)30 def combo_action_audience(self):31 combo = self.modal.combo_by_title('Público da ação')32 return ComboBox(combo)33 def input_initial_date(self):34 return self.modal.content.s(35 "./descendant::*[text()='Data de início']/../following-sibling::*/descendant::input")36 def input_end_date(self):37 return self.modal.content.s(38 "./descendant::*[text()='Data de término']/../following-sibling::*/descendant::input")39 def fill_new_banner_popup(self, **kwargs):40 if kwargs.get('supplier'):41 self.combo_supplier().select(kwargs.get('supplier'))42 if kwargs.get('validity'):43 self.combo_validity().select(kwargs.get('validity'))44 if kwargs.get('initial_date'):45 self.input_initial_date().with_(Config(46 set_value_by_js=True)).set_value(kwargs.get('initial_date'))47 if kwargs.get('validity') == 'Personalizado':48 self.input_end_date().with_(Config(49 set_value_by_js=True)).set_value(kwargs.get('end_date'))50 if kwargs.get('action_audience'):51 self.combo_action_audience().select(kwargs.get('action_audience'))52 if kwargs.get('action_audience') == 'Subir lista':53 self.upload_stores()54 def upload_stores(self):55 self.modal.btn_by_title('SUBIR LISTA DE LOJAS').click()56 upload_area_selector = self.modal.content.s("./descendant::input[@type='file']")57 upload_area_selector.type(os.path.abspath(FilePath.STORES.value))58 upload_stores_list_tags = self.modal.content.s("//*[contains(@class, 'UploadTags_fileIte')]")59 assert upload_stores_list_tags.wait_until(be.clickable)60 self.modal.confirm()61 def combo_repository(self, label):62 combo = self.get_combo_by_label(label, self.card_new_banner_repository)63 return ComboBox(combo)64 def input_repository(self, label):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Selene automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful