예제 #1
0
	def get_xpath(self):
		has_aria_label = self.matches.xpath('@aria-label', self.search_text)
		has_text = self.matches.xpath('.', self.search_text)
		has_text_or_aria_label = predicate_or(has_aria_label, has_text)
		return ' | '.join([
			super(ButtonImpl, self).get_xpath(), self.get_input_button_xpath(),
			"//*[@role='button']" + has_text_or_aria_label,
			"//button" + predicate(has_aria_label)
		])
예제 #2
0
	def get_input_button_xpath(self):
		if self.search_text:
			has_value = self.matches.xpath('@value', self.search_text)
			has_label = self.matches.xpath('@label', self.search_text)
			has_aria_label = self.matches.xpath('@aria-label', self.search_text)
			has_title = self.matches.xpath('@title', self.search_text)
			has_text = \
				predicate_or(has_value, has_label, has_aria_label, has_title)
		else:
			has_text = ''
		return "//input[@type='submit' or @type='button']" + has_text
예제 #3
0
	def test_two_args(self):
		self.assertEqual('[a=b or c=d]', predicate_or('a=b', 'c=d'))
예제 #4
0
	def test_one_arg(self):
		self.assertEqual('[a=b]', predicate_or('a=b'))
예제 #5
0
	def test_no_args(self):
		self.assertEqual('', predicate_or())
예제 #6
0
	def test_empty_arg_among_normal_args(self):
		self.assertEqual('[a=b or c=d]', predicate_or('a=b', '', 'c=d'))
예제 #7
0
	def test_one_empty_arg(self):
		self.assertEqual('', predicate_or(''))