Best Python code snippet using SeleniumBase
base_case.py
Source:base_case.py
...879 self.__add_bootstrap_tour_step(880 message, selector=selector, name=name, title=title,881 alignment=alignment, duration=duration)882 elif "Hopscotch" in self._tour_steps[name][0]:883 self.__add_hopscotch_tour_step(884 message, selector=selector, name=name, title=title,885 alignment=alignment)886 elif "IntroJS" in self._tour_steps[name][0]:887 self.__add_introjs_tour_step(888 message, selector=selector, name=name, title=title,889 alignment=alignment)890 else:891 self.__add_shepherd_tour_step(892 message, selector=selector, name=name, title=title,893 theme=theme, alignment=alignment)894 def __add_shepherd_tour_step(self, message, selector=None, name=None,895 title=None, theme=None, alignment=None):896 """ Allows the user to add tour steps for a website.897 @Params898 message - The message to display.899 selector - The CSS Selector of the Element to attach to.900 name - If creating multiple tours at the same time,901 use this to select the tour you wish to add steps to.902 title - Additional header text that appears above the message.903 theme - (NON-Bootstrap Tours ONLY) The styling of the tour step.904 Choose from "light"/"arrows", "dark", "default", "square",905 and "square-dark". ("arrows" is used if None is selected.)906 alignment - Choose from "top", "bottom", "left", and "right".907 ("top" is the default alignment).908 """909 if theme == "default":910 shepherd_theme = "shepherd-theme-default"911 elif theme == "dark":912 shepherd_theme = "shepherd-theme-dark"913 elif theme == "light":914 shepherd_theme = "shepherd-theme-arrows"915 elif theme == "arrows":916 shepherd_theme = "shepherd-theme-arrows"917 elif theme == "square":918 shepherd_theme = "shepherd-theme-square"919 elif theme == "square-dark":920 shepherd_theme = "shepherd-theme-square-dark"921 else:922 shepherd_base_theme = re.search(923 r"[\S\s]+classes: '([\S\s]+)',[\S\s]+",924 self._tour_steps[name][0]).group(1)925 shepherd_theme = shepherd_base_theme926 shepherd_classes = shepherd_theme927 if selector == "html":928 shepherd_classes += " shepherd-orphan"929 buttons = "firstStepButtons"930 if len(self._tour_steps[name]) > 1:931 buttons = "midTourButtons"932 step = ("""933 tour.addStep('%s', {934 title: '%s',935 classes: '%s',936 text: '%s',937 attachTo: {element: '%s', on: '%s'},938 buttons: %s,939 advanceOn: '.docs-link click'940 });""" % (941 name, title, shepherd_classes, message, selector, alignment,942 buttons))943 self._tour_steps[name].append(step)944 def __add_bootstrap_tour_step(self, message, selector=None, name=None,945 title=None, alignment=None, duration=None):946 """ Allows the user to add tour steps for a website.947 @Params948 message - The message to display.949 selector - The CSS Selector of the Element to attach to.950 name - If creating multiple tours at the same time,951 use this to select the tour you wish to add steps to.952 title - Additional header text that appears above the message.953 alignment - Choose from "top", "bottom", "left", and "right".954 ("top" is the default alignment).955 duration - (Bootstrap Tours ONLY) The amount of time, in seconds,956 before automatically advancing to the next tour step.957 """958 if selector != "html":959 selector = self.__make_css_match_first_element_only(selector)960 element_row = "element: '%s'," % selector961 else:962 element_row = ""963 if not duration:964 duration = "0"965 else:966 duration = str(float(duration) * 1000.0)967 step = ("""{968 %s969 title: '%s',970 content: '%s',971 orphan: true,972 placement: 'auto %s',973 smartPlacement: true,974 duration: %s,975 },""" % (element_row, title, message, alignment, duration))976 self._tour_steps[name].append(step)977 def __add_hopscotch_tour_step(self, message, selector=None, name=None,978 title=None, alignment=None):979 """ Allows the user to add tour steps for a website.980 @Params981 message - The message to display.982 selector - The CSS Selector of the Element to attach to.983 name - If creating multiple tours at the same time,984 use this to select the tour you wish to add steps to.985 title - Additional header text that appears above the message.986 alignment - Choose from "top", "bottom", "left", and "right".987 ("bottom" is the default alignment).988 """989 arrow_offset_row = None990 if not selector or selector == "html":991 selector = "head"...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!