“His master's wife cast her eyes.” “Therefore, men of heart, hear me” (Job 34:10) – what is the craft of the Holy One blessed be He? “For He pays a person for his action” (Job 34:11) – [as stated by] Rabbi Meir, Rabbi Yehuda, and Rabbi Shimon.5See Bereshit Rabba 84:7, where these Sages state what slanderous reports Joseph brought to Jacob about his brothers. The midrash there asserts that the challenges later faced by Joseph, including his encounter with Potiphar’s wife, was punishment for his slandering his brothers.
“His master's wife cast her eyes” – what is written prior to this matter? “Joseph was of fine form and of fair appearance” (Genesis 39:6). This is analogous to a mighty man who was standing in the street grooming his eyes, curling his hair, and lifting his heels. He said: ‘This is appropriate for me, becoming for me, [as I am] fair and mighty.’
They said to him: ‘If you are mighty, if you are fair, there is a she-bear before you, arise and attack it.’6Because Joseph was involved in beautifying himself, he was tested by his encounter with the wife of Potiphar, who is compared to the bear. Alternatively, Joseph was very confident in his spiritual abilities, and was therefore tested with this temptation (Nezer HaKodesh).