bcpkgfox 0.18.1__tar.gz → 0.18.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bcpkgfox might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.18.1
3
+ Version: 0.18.3
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: BCFOX
@@ -225,7 +225,7 @@ def wait_for_element_disappear(object, type, timeout=10):
225
225
 
226
226
  return find_elements.backcode__dont_use__wait_for_d(driver, object, type, timeout=tempo)
227
227
 
228
- def selectfox(elemento, method, key, relative = None):
228
+ def selectfox(elemento, method, key, relative = None, unicode=False):
229
229
  """
230
230
  Seleciona uma opção em um elemento <select>.
231
231
 
@@ -262,22 +262,39 @@ def selectfox(elemento, method, key, relative = None):
262
262
  if method == "value":
263
263
  select.select_by_value(key)
264
264
 
265
- if method == "text":
266
- elements = select.options
267
- for elm in elements:
268
- if relative:
269
- if key.lower().strip() in elm.text.lower().strip():
270
- select.select_by_visible_text(elm.text)
271
- return
272
- else:
273
- if key == elm.text:
274
- select.select_by_visible_text(elm.text)
275
- return
276
-
277
- raise ModuleNotFoundError(f"Option {key} não encontrada")
265
+ elements = select.options
266
+ if method == "text" and not unicode:
267
+ for elm in elements:
268
+ if relative:
269
+ if key.lower().strip() in elm.text.lower().strip():
270
+ select.select_by_visible_text(elm.text)
271
+ return
272
+ else:
273
+ if key == elm.text:
274
+ select.select_by_visible_text(elm.text)
275
+ return
276
+
277
+ if method == "text" and unicode:
278
+ key_normalize = normalize(key.lower().strip())
279
+ for elm in elements:
280
+ text_normalize = normalize(elm.text.lower().strip())
281
+ if relative:
282
+ if key_normalize in text_normalize:
283
+ select.select_by_visible_text(elm.text)
284
+ return
285
+ else:
286
+ if key_normalize == text_normalize:
287
+ select.select_by_visible_text(elm.text)
288
+ return
289
+
290
+ raise ModuleNotFoundError(f"Option {key} não encontrada")
278
291
 
279
292
  if method == "index":
280
293
  select.select_by_index(key)
294
+ def normalize(text):
295
+ import unicodedata
296
+ return unicodedata.normalize("NFKD", text).encode("ASCII", "ignore").decode("ASCII").lower()
297
+
281
298
 
282
299
  def pop_up_extract(text: bool = False, accept: bool = False, timeout: int = 10, driver_instance: Optional[WebElement] = None):
283
300
  """ Identifica um pop-up simples extraindo o texto e aceitando ele também. \n
@@ -571,6 +571,17 @@ class _LoginPje:
571
571
  self.driver.get(f"{self.url_procurada}")
572
572
  time.sleep(2)
573
573
 
574
+
575
+ if self._verica_captcha():
576
+ if self._util.deve_usar_whom():
577
+ self._util.login_via_whom()
578
+ if self._verificar_ja_logado():
579
+ print(" ✓ Login via WHOM realizado com sucesso!")
580
+ return True
581
+ else:
582
+ print("⚠ Login via WHOM falhou. Não há fallback disponível para este estado.")
583
+ raise Exception("Falha no login via WHOM")
584
+
574
585
  # ══════════════════════════════════════════════════════════════
575
586
  # PRIORIDADE 1: Verifica se já está logado
576
587
  # ══════════════════════════════════════════════════════════════
@@ -828,6 +839,11 @@ class _LoginPje:
828
839
  return True
829
840
  else:
830
841
  return False
842
+ def _verica_captcha(self):
843
+ if 'Vamos confirmar que você é humano' in self.driver.page_source:
844
+ return True
845
+ else:
846
+ return False
831
847
 
832
848
  def _fechar_popup_certificado(self):
833
849
  if "Certificado próximo de expirar" in self.driver.page_source:
@@ -931,7 +947,7 @@ class _Utils:
931
947
  """
932
948
  if self.tipo_login.lower() == "mysena" or "my" in self.tipo_login.lower():
933
949
  return False
934
- elif 'whoom' in self.tipo_login.lower() or self.tipo_login.lower() == 'whoom' or self.tipo_login.lower() == 'whom' or self.tipo_login.lower() == 'wh' or 'wh' in self.tipo_login.lower() :
950
+ elif 'whoom' in self.tipo_login.lower() or 'whoon' in self.tipo_login.lower() or self.tipo_login.lower() == 'whoom' or self.tipo_login.lower() == 'whom' or self.tipo_login.lower() == 'wh' or 'wh' in self.tipo_login.lower() :
935
951
  return True
936
952
  else:
937
953
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.18.1
3
+ Version: 0.18.3
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: BCFOX
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="bcpkgfox",
5
- version="0.18.1",
5
+ version="0.18.3",
6
6
  author="BCFOX",
7
7
  author_email="bcfox@bcfox.com.br",
8
8
  description="Biblioteca BCFOX",
File without changes
File without changes
File without changes
File without changes
File without changes